function showmsgjquery(obj, className, innerHTML) {
    jQuery('#' + obj).removeAttr("class").addClass(className);
    jQuery('#' + obj).html(innerHTML);
}
//页内锚点平滑跳转
jQuery.fn.anchorGoWhere = function (options) {
    var obj = jQuery(this);
    var defaults = { target: 0, timer: 1000 };
    var o = jQuery.extend(defaults, options);
    obj.each(function (i) {
        jQuery(obj[i]).click(function () {
            var _rel = jQuery(this).attr("href").substr(1);
            switch (o.target) {
                case 1:
                    var _targetTop = jQuery("#" + _rel).offset().top;
                    jQuery("html,body").animate({ scrollTop: _targetTop }, o.timer);
                    break;
                case 2:
                    var _targetLeft = jQuery("#" + _rel).offset().left;
                    jQuery("html,body").animate({ scrollLeft: _targetLeft }, o.timer);
                    break;
            }
            return false;
        });
    });
};
//
function check_all() {
    var ids = $tag($('ids'), 'input');
    for (var i = 0; i < ids.length; i++) { ids[i].checked = $('check_all').checked; }
}
function is_check_all() {
    var ids = $tag($('ids'), 'input');
    var e = true;
    for (var i = 0; i < ids.length; i++) { if (!ids[i].checked) { e = false; break; } }
    $('check_all').checked = e;
}

//
function select_all() {
    var ids = $tag($('ids'), 'input');
    var uid = '';
    for (var i = 0; i < ids.length; i++) { if (ids[i].type == 'checkbox' && ids[i].checked == true && ids[i].lang == 'ids') { uid += ids[i].value + ','; } }
    uid = uid.substring(0, uid.length - 1);
    return uid;
}

//
function ajax_delete(ids, action) {
    if (ids == 0) ids = select_all();
    if (empty(ids)) return;
    var count = ids.split(',');
    if (!confirm('确定删除？')) return;
    msgbox('删除', '<div class="loading1">Waiting...</div>', 340, 200);
    var url = '../ajax.php?ids=' + encodeURIComponent(ids) + '&action=delete_' + action;
    ajax.response(xml, url, ajax_delete_ed);
}
function ajax_delete_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    if (html.indexOf('succeed') != -1) {
        msgbox('删除', '<div class="succeed1">Done</div>', 340, 200);
        setTimeout("winreload();", 1000);
    } else {
        msgbox('删除', '<div class="error1">' + html + '</div>', 340, 200);
        setTimeout("hide_msgbox();", 2000);
    }
}

//
function roll(obj, tagName, delay, speed, lineHeight) {
    var slideBox = $(obj);
    if (!slideBox) return;
    var tid = null, pause = false;
    var objHeight = slideBox.offsetHeight;
    var item_count = $tag(slideBox, tagName).length;
    if (item_count < 2) return;
    var itemHeight = $tag(slideBox, tagName)[0].offsetHeight;
    var item_total_height = item_count * itemHeight;
    var start = function () { tid = setInterval(slide, speed); };
    var slide = function () {
        if (pause) return;
        slideBox.scrollTop += 2;
        if (slideBox.scrollTop % lineHeight == 0) {
            clearInterval(tid);
            slideBox.appendChild($tag(slideBox, tagName)[0]);
            slideBox.scrollTop = 0;
            setTimeout(start, delay);
        }
    }
    slideBox.onmouseover = function () { pause = true; };
    slideBox.onmouseout = function () { pause = false; };
    if (application.isIE) {
        (objHeight < item_total_height) ? setTimeout(start, 2000) : slideBox.style.height = item_total_height + 10;
    } else { setTimeout(start, 2000); }
}

//
function register() {
    var email = $('email').value;
    var user_name = $('user_name').value;
    var password = $('password').value;
    var password1 = $('password1').value;
    var qq = $('qq').value;
    var phone = $('phone').value;

    email = email.toLowerCase();
    user_name = user_name.trim();
    $('user_name').value = user_name;
    if (!is_email(email)) { showmsg('msg', 'error', '请输入正确的Email'); return; }
    if (empty(user_name) || user_name.match(/[^\u4E00-\u9FA5]/g)) { showmsg('msg', 'error', '用户名必须为中文'); return; }
    if (password.len() < 6) { showmsg('msg', 'error', '密码最短要求6个字符'); return; }
    if (password != password1) { showmsg('msg', 'error', '确认密码'); return; }
    if (!is_qq(qq)) { showmsg('msg', 'error', '请输入正确的QQ号码'); return; }
    if (!is_mobile(phone)) { showmsg('msg', 'error', '请输入正确的手机号码'); return; }

    $('btn').disabled = true;
    showmsg('msg', 'loading', '正在注册,请稍候...');
    var url = '../ajax.php?email=' + encodeURIComponent(email) + '&user_name=' + encodeURIComponent(user_name) + '&password=' + encodeURIComponent(password) + '&qq=' + encodeURIComponent(qq) + '&phone=' + encodeURIComponent(phone) + '&action=register';
    ajax.response(xml, url, register_ed);
}
function register_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    if (html.indexOf("succeed") != -1) {
        showmsg('msg', 'succeed', 'Success!');
        var username = $('user_name').value;
        var password = $('password').value;
        var email = $('email').value;
        var group_id = 8;
        forum_register(username, password, email, group_id);
        var href = winhref();
        (href.lastIndexOf('register_forum') == -1) ? href = 'info.php' : href = 'forum/';
        setTimeout("header('" + href + "')", 2000);
    } else {
        $('btn').disabled = false;
        showmsg('msg', 'error', html);
    }
}

//
function forum_register(username, password, email, group_id) {
    var url = 'forum/ucp.php?username=' + encodeURIComponent(username) + '&email=' + encodeURIComponent(email) + '&email_confirm=' + encodeURIComponent(email) + '&new_password=' + encodeURIComponent(password) + '&password_confirm=' + encodeURIComponent(password) + '&group_id=' + group_id + '&lang=en&tz=0&agreed=true&change_lang=0&submit=on&mode=register_';
    ajax.response(xml, url, forum_register_ed);
}
function forum_register_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    var username = $('user_name').value;
    var password = $('password').value;
    forum_login(username, password);
}

//加盟申请
function register_application() {
    var email = $('email').value;
    var user_name = $('user_name').value;
    var phone = $('phone').value;
    var image = $j('#image').val();
    var qq = $j('#qq').val();

    email = email.toLowerCase();
    user_name = user_name.trim();
    $('user_name').value = user_name;
    if (image == '您设计的LOGO图片' || image == '') { showmsg('msg', 'error', '请上传的作品'); return false; }
    if (!is_email(email)) { showmsg('msg', 'error', '请输入正确的Email'); return false; }
    if (empty(user_name) || user_name.match(/[^\u4E00-\u9FA5]/g)) { showmsg('msg', 'error', '用户名必须为中文'); return false; }
    if (!is_mobile(phone)) { showmsg('msg', 'error', '请输入正确的手机号码'); return false; }
    if (!is_qq(qq)) { showmsg('msg', 'error', '请输入正确的QQ号码'); return false; }
    return true;
}



//
function designer_login() {
    var email = $('email').value;
    var password = $('password').value;
    if (email == '' || password == '') { $('email').focus(); return; }
    showmsg('designer_msg', 'loading', '正在验证...');
    var url = '../ajax.php?email=' + encodeURIComponent(email) + '&password=' + encodeURIComponent(password) + '&action=designer_login';
    ajax.response(xml, url, designer_login_ed);
}
function designer_login_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    if (html.indexOf("succeed") != -1) {
        $j('#interface').contents().find("body").append(html);
        showmsg('designer_msg', 'succeed', '登录成功');
        var url = get('url');
        (url) ? header(url) : setTimeout("header('designerhall.php')", 1000);
    } else {
        showmsg('designer_msg', 'error', '用户名或密码错误');
    }
}

//投票，设计师登录
function vote_designer_login() {
    var email = $('email').value;
    var password = $('password').value;
    if (email == '' || password == '') { $('email').focus(); return; }
    showmsg('designer_msg', 'loading', '正在验证...');
    var url = '../ajax.php?email=' + encodeURIComponent(email) + '&password=' + encodeURIComponent(password) + '&action=designer_login';
    ajax.response(xml, url, vote_designer_login_ed);
}
function vote_designer_login_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    if (html.indexOf("succeed") != -1) {
        jQuery('#interface').contents().find("body").append(html);
        showmsg('designer_msg', 'succeed', '登录成功');
        setTimeout("winreload();", 1000);
    } else {
        showmsg('designer_msg', 'error', '用户名或密码错误');
    }
}

//
function designer_login_() {
    var email = $('email').value;
    var password = $('password').value;
    if (email == '' || password == '') { $('email').focus(); return; }
    showmsg('designer_msg', 'loading', '正在验证...');
    var url = '../ajax.php?email=' + encodeURIComponent(email) + '&password=' + encodeURIComponent(password) + '&action=designer_login';
    ajax.response(xml, url, designer_login__ed);
}
function designer_login__ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    if (html.indexOf("succeed") != -1) {
        showmsg('designer_msg', 'succeed', '登录成功');
        var user_name = $('email').value;
        var password = $('password').value;
        forum_login(user_name, password);
        setTimeout("header('forum/')", 2000);
    } else {
        showmsg('designer_msg', 'error', '用户名或密码错误');
    }
}

//
function client_login() {
    var phone = $j('#phone').val();
    var password = $('client_pwd').value;
    if (!is_mobile(phone)) { showmsg('client_msg', 'error', '请正确输入您的手机号码'); return; }
    if (password == '') { $('client_pwd').focus(); showmsg('client_msg', 'error', '请输入您的密码'); return; }
    showmsg('client_msg', 'loading', '正在验证...');
    jQuery.ajax({
        type: 'POST',
        url: '../ajax.php',
        data: 'phone=' + encodeURIComponent(phone) + '&password=' + encodeURIComponent(password) + '&action=client_login',
        success: function (html) {
            if (html.indexOf("succeed") != -1) {
                showmsg('client_msg', 'succeed', '登录成功');
                var url = get('url');
                (url) ? header(url) : setTimeout("header('projects.php')", 1000);
            } else {
                showmsg('client_msg', 'error', '手机号码或密码错误');
            }
        },
        failure: function () { alert('Ajax Error!'); }
    });
}

//
function client_login_() {
    var phone = $('phone').value;
    if (!is_mobile(phone)) { showmsg('client_msg', 'error', '请正确输入您的手机号码'); return; }
    showmsg('client_msg', 'loading', '正在验证...');
    var url = '../ajax.php?phone=' + encodeURIComponent(phone) + '&action=client_login';
    ajax.response(xml, url, client_login__ed);
}
function client_login__ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    if (html.indexOf("succeed") != -1) {
        showmsg('client_msg', 'succeed', '登录成功');
        var phone = $('phone').value;
        var user_name = 'logo' + phone.substring(6);
        var password = user_name;
        forum_login(user_name, password);
        setTimeout("header('forum/')", 2000);
    } else {
        showmsg('client_msg', 'error', '您还没有注册');
    }
}

//
function forum_login(user_name, password) {
    var url = 'forum/ucp.php?username=' + encodeURIComponent(user_name) + '&password=' + encodeURIComponent(password) + '&autologin=on&login=on&mode=login';
    ajax.response(xml, url, null);
}

//


//
function forum_logout() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    var url = "forum/ucp.php?mode=logout";
    ajax.response(xml, url, winreload);
}

//

function modify_info(closepanel) {
    var email = $('email').value;
    var user_name = $('user_name').value;
    var face = $('face').value;
    var qq = $('qq').value;
    //var msn = $('msn').value;
    var phone = $('phone').value;
    //var paypal = $('paypal').value;
    var short_intro = $('short_intro').value;
    var intro = ($('intro').value == "简单介绍一下个人或者团队优势，让买家认识你，取得买家的认可与信任。") ? "" : $('intro').value;
    intro = br2nl(intro);
    var school = ($('school').value == "填写相关的毕业院校可以进一步体现你的专业性，获得买家认可哦！") ? "" : $('school').value;
    //var hourlywage = $('hourlywage').value;

    email = email.toLowerCase();
    user_name = user_name.trim();
    $('user_name').value = user_name;
    if (!is_email(email)) { showmsg('msg', 'error', '请输入正确的Email'); return; }
    if (empty(user_name)) { showmsg('msg', 'error', '请重新输入用户名'); return; }
    if (!is_qq(qq)) { showmsg('msg', 'error', '请输入正确的QQ号码'); return; }
    //if(!empty(msn)&&!is_email(msn)){showmsg('msg','error','请输入正确的msn帐号');return;}
    if (!is_mobile(phone)) { showmsg('msg', 'error', '请输入正确的手机号码'); return; }
    if (short_intro == '' || short_intro == '请一句话概括。。。(不超过35字)') { showmsg('msg', 'error', '请输入设计宣言'); return; }
    if (intro == "") { showmsg('msg', 'error', '请输入简单介绍'); return; }
    //if(hourlywage=="" || hourlywage=='0'){showmsg('msg','error','请输入雇佣时薪');return;}

    $('modify_info_btn').disabled = true;
    $('modify_info_btn2').disabled = true;
    //showmsg('msg','loading','正在更新...');
    jQuery.ajax({
        type: "POST",
        url: "../ajax.php",
        data: 'email=' + encodeURIComponent(email) + '&user_name=' + encodeURIComponent(user_name) + '&face=' + encodeURIComponent(face) + '&qq=' + encodeURIComponent(qq) + '&intro=' + encodeURIComponent(intro) + '&school=' + encodeURIComponent(school) + '&phone=' + encodeURIComponent(phone) + '&website=' + short_intro + '&action=modify_info',
        success: function () {
            if (closepanel == 1) {
                //直接关闭当前面板
                showmsg('msg', 'succeed', '修改成功!');
                setTimeout(function () {
                    jQuery.colorbox.close();
                    window.location.reload();
                }, 1000);

            } else {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", inline: true, href: "#wsstep2" });
            }
        },
        failure: function () { }
    });
}

//
function modify_paypal() {
    var paypal = $('paypal').value;
    if (paypal == jQuery('#paypal').attr('lang')) {
        showmsg('msg', 'error', '请按要求填写信息！');
        return;
    }
    $('btn').disabled = true;
    showmsg('msg', 'loading', '正在更新...');
    var url = '../ajax.php?paypal=' + encodeURIComponent(paypal) + '&action=modify_paypal';
    ajax.response(xml, url, modify_paypal_ed);
}
function modify_paypal_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    $('btn').disabled = false;
    if (html.indexOf("succeed") != -1) {
        showmsg('msg', 'succeed', '修改成功!');
    } else {
        showmsg('msg', 'error', html);
    }
}

//
function modify_password() {
    var oldpassword = $('oldpassword').value;
    var password = $('password').value;
    var password1 = $('password1').value;
    if (oldpassword.len() < 6) { showmsg('password_msg', 'error', '旧密码至少为6位！'); return; }
    if (password.len() < 6) { showmsg('password_msg', 'error', '新密码至少为6位！'); return; }
    if (password != password1) { showmsg('password_msg', 'error', '确认密码错误！'); return; }
    $('password_btn').disabled = true;
    showmsg('password_msg', 'loading', 'Updateing...');
    url = '../ajax.php?password=' + encodeURIComponent(password) + '&oldpassword=' + encodeURIComponent(oldpassword) + '&action=modify_password';
    ajax.response(xml, url, modify_password_ed);
}
function modify_password_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    $('password_btn').disabled = false;
    if (html.indexOf("succeed") != -1) {
        showmsg('password_msg', 'succeed', '修改成功!');
        setTimeout("winreload();", 1500);
    } else {
        showmsg('password_msg', 'error', html);
    }
}

//
function send_validate_email() {
    msgbox('邮箱验证', '<div class="loading1">请稍候...</div>', 340, 200);
    var url = '../ajax.php?action=send_validate_email';
    ajax.response(xml, url, send_validate_email_ed);
}
function send_validate_email_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    $('init').innerHTML = "<img src='/images/succeed2.gif' align='absmiddle' /> 我们已经向您的邮箱发送了确认邮件. 请检查您的注册邮箱, 并点击我们的确认信.";
}

//
function validate_user_email() {
    var email = get('email');
    var key = get('key');
    if (!email || !key) { msgbox('Email verified', '<div class="error1">请输入正确的邮箱地址</div>', 340, 200); return; }
    msgbox('邮箱验证', '<div class="loading1">请稍候...</div>', 340, 200);
    var url = '../ajax.php?email=' + encodeURIComponent(email) + '&key=' + encodeURIComponent(key) + '&action=validate_user_email';
    ajax.response(xml, url, validate_user_email_ed);
}
function validate_user_email_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    if (html.indexOf("succeed") != -1) {
        msgbox('邮箱验证', '<div class="succeed1">您的邮箱成功确认!</div>', 340, 200);
    } else {
        msgbox('邮箱验证', '<div class="succeed1">Email不正确!</div>', 340, 200);
    }
    setTimeout("hide_msgbox();msgbox('邮箱验证','<div class=loading1>正跳转到首页...</div>',340,200);", 2000);
    setTimeout("header('index.php')", 5000);
}

//
function find_password() {
    var email = $('email').value;
    if (!is_email(email)) { showmsg('msg', 'error', 'Incorrect Email'); return; }
    $('btn').disabled = true;
    showmsg('msg', 'loading', 'Waiting...');
    var url = '../ajax.php?email=' + encodeURIComponent(email) + '&action=find_password';
    ajax.response(xml, url, find_password_ed);
}
function find_password_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    if (html.indexOf("succeed") != -1) {
        showmsg('msg', 'succeed', '密码邮件已发送...');
    } else {
        $('btn').disabled = false;
        showmsg('msg', 'error', '用户不存在!');
    }
}

//
function get_account(user_id, page) {
    var url = '../ajax_page.php?user_id=' + user_id + '&page=' + page + '&action=get_account';
    ajax.response(ajax_account, url, get_account_ed);
}
function get_account_ed() {
    var html = ajax.request(ajax_account);
    if (typeof (html) == 'undefined') return;
    $('account_list').innerHTML = html;
}

//
function show_project_content() {
    var obj = 'project_content';
    var tree = 'tree';
    if ($(obj).style.display == 'none') {
        $(obj).style.display = 'block';
        $(tree).src = '/images/minusthin.gif';
    } else {
        $(obj).style.display = 'none';
        $(tree).src = '/images/plusthin.gif';
    }
}
function show_project_content_temp() {
    var obj = 'project_content';
    var tree = 'tree';
    if ($(obj).style.display == 'none') {
        $(obj).style.display = 'block';
        jQuery('.icon-project-title').addClass("off");
    } else {
        $(obj).style.display = 'none';
        jQuery('.icon-project-title').removeClass("off");
    }
}

//
function upload_start(type) {
    if (type == 'addition') {
        msgbox('上传', '<iframe src="../upload2.php?type=' + type + '" width="100%" height="230" scrolling="no" frameborder="0"></iframe>', 380, 150);
    } else {
        msgbox('上传', '<iframe src="../upload.php?type=' + type + '" width="100%" height="230" scrolling="no" frameborder="0"></iframe>', 380, 150);
    }
}
//同时上传多个文件
function batch_upload_start(type) {
    msgbox('上传', '<iframe src="../batchupload.php?type=' + type + '" width="100%" height="230" scrolling="no" frameborder="0"></iframe>', 380, 150);
}
function caseupload_start(type, casetypeid) {
    msgbox('上传', '<iframe src="../upload.php?type=' + type + '&casetypeid=' + casetypeid + '" width="450" height="230" scrolling="no" frameborder="0"></iframe>', 470, 150);
}
//上传作品
function upload_work(type) {
    var cookie_user_id = $('cookie_user_id').value;
    var invite_ids = $j('#invite_ids').val();
    if (empty(cookie_user_id)) {
        var href = winhref();
        var pos = href.lastIndexOf('/');
        var url = href.substring(pos + 1);
        url = 'login.php?url=' + url;
        header(url);
        return;
    }
    var work = 0;
    if (type != 'logo') {
        if ($j.inArray(cookie_user_id, invite_ids.split(',')) > -1) {
            work = 0;
        } else {
            work = 1;
        }
    }
    msgbox('上传设计作品...', '<iframe src="../upload.php?type=' + type + '&work=' + work + '" width="100%" height="250" scrolling="no" frameborder="0"></iframe>', 380, 100);

}
//设计总监项目上传作品
function upload_work_no_limit(type) {
    var work = 0;
    msgbox('上传作品...', '<iframe src="../vipdesign_upload.php?type=' + type + '&work=' + work + '" width="100%" height="250" scrolling="no" frameborder="0"></iframe>', 380, 80);
}
//上传作品
function list_upload_work(type, designer_id, pid) {
    var cookie_user_id = designer_id;
    /*if(empty(cookie_user_id)){
      var href = winhref();
      var pos = href.lastIndexOf('/');
      var url = href.substring(pos+1);
      url = 'login.php?url='+url;
      header(url);
      return;
    } */
    msgbox('上传设计作品...', '<iframe src="../upload.php?type=' + type + '&casetypeid=' + pid + '" width="100%" height="250" scrolling="no" frameborder="0"></iframe>', 380, 100);

}

//上传作品
function upload_user_work(type, casetypeid) {
    var cookie_user_id = $('cookie_user_id').value;
    if (empty(cookie_user_id)) {
        var href = winhref();
        var pos = href.lastIndexOf('/');
        var url = href.substring(pos + 1);
        url = 'login.php?url=' + url;
        header(url);
        return;
    }
    msgbox('上传设计作品...', '<iframe src="../upload.php?type=' + type + '&casetypeid=' + casetypeid + '" width="100%" height="250" scrolling="no" frameborder="0"></iframe>', 380, 100);
}

//
function upload_cover() {
    var cookie_user_id = $('cookie_user_id').value;
    if (empty(cookie_user_id)) {
        var href = winhref();
        var pos = href.lastIndexOf('/');
        var url = href.substring(pos + 1);
        url = 'login.php?url=' + url;
        header(url);
        return;
    }
    msgbox('上传个人广告牌', '<iframe src="../upload.php?type=cover" width="100%" height="250" scrolling="no" frameborder="0"></iframe>', 380, 100);
}

//
function validate_image(src) {
    var src, img, img_type;
    var src = $('image').value;
    src = src.toLowerCase();
    img = src.split('.');
    img_type = img[img.length - 1];
    if (img_type == 'png' || img_type == 'gif' || img_type == 'jpg') {
        showmsg('msg', 'msg', '');
        return true;
    } else {
        showmsg('msg', 'error', '支持图片格式: png, gif, jpg');
        return false;
    }
}
function upload() {
    var src = $('image').value;
    if (document.getElementById('message')) {
        $('message').value = ($('message').value == $('message').lang) ? "" : $('message').value;
    }
    if (!validate_image(src)) return;
    showmsg('msg', 'loading', '上传中,请稍候...');
    $('myform').submit();
    $('image').disabled = true;
    $('upload_btn').disabled = true;
}

//
function upload_package_start() {
    var cbox = null;
    if (jQuery('#clausecbox').size() > 0) {
        cbox = jQuery('#clausecbox');
        if (!cbox.is(":checked")) {
            msgbox('', '<div class="alert alert-danger" style="margin:0;">请先阅读设计师承诺书</div>', 300, 200);
            return false;
            return;
        }
    }
    var project_id = $('project_id').value;
    var package = $('package').value;
    if (!is_numeric(project_id)) return;
    if (!empty(package) && !confirm('确认你要再次上传Logo打包文件吗?\n\n新文件将覆盖原来上传的打包文件.')) return;
    msgbox('上传中...', '<iframe src="../upload1.php?project_id=' + project_id + '&type=package" width="100%" height="160" scrolling="no" frameborder="0"></iframe>', 380, 150);
}

//
function send_project_message() {
    var project_id = $('project_id').value;
    var message = $('project_message').value;
    if (empty(message)) { $('project_message').focus(); return; }
    $('project_message_btn').disabled = true;
    $j.post('/Employer/PostDiscus', { 'id': project_id, 'message': message}, function (data) {
        $('project_message_btn').disabled = false;

        if (data == 'succeed') {
            location.reload();
        } else {
            msgbox('', '<div class="error1">' + data + '</div>', 340, 200);
            setTimeout("hide_msgbox();", 2000);
        }
    });
}

function send_project_message_addition(file, message) {
    var project_id = $('project_id').value;
    $j.post('../ajax.php', { 'project_id': project_id, 'message': message, 'file': file, 'action': 'send_project_message_addition' }, function (data) {
        if (data == 'succeed') {
            
           
            location.reload();
        } else {
            msgbox('', '<div class="error1">' + data + '</div>', 340, 200);
            setTimeout("hide_msgbox();", 2000);
        }
    });
}

//
function send_brand_message() {
    var project_id = $('project_id').value;
    var message = $('project_message').value;
    if (empty(message)) { $('project_message').focus(); return; }
    $('project_message_btn').disabled = true;
    $j.post('../ajax.php', { 'project_id': project_id, 'message': message, 'action': 'send_project_message', 'type': 'brand' }, function (data) {
        $('project_message_btn').disabled = false;

        if (data == 'succeed') {
            $('project_message').value = '';
            var id = $('project_id').value;
            get_brand_message(id, 100);
        } else {
            msgbox('', '<div class="error1">' + data + '</div>', 340, 200);
            setTimeout("hide_msgbox();", 2000);
        }
    });
}

//
function get_project_message(project_id, page) {
    var url = '../ajax_page.php?project_id=' + project_id + '&page=' + page + '&action=get_project_message';
    ajax.response(ajax_project_message, url, get_project_message_ed);
}
function get_project_message_ed() {
    var html = ajax.request(ajax_project_message);
    if (typeof (html) == 'undefined') return;
    // $('project_message_list').innerHTML = html;
    var exists = $j('#project_message_list').html();
    //$j('#project_message_list').html(exists + html);
    $j('#project_message_list').html(html);
}

function get_brand_message(project_id, page) {
    var url = '../ajax_page.php?project_id=' + project_id + '&page=' + page + '&action=get_project_message&type=brand';
    ajax.response(ajax_project_message, url, get_project_message_ed);
}


//
function delete_project_message(id) {
    if (!confirm('确认您要删除吗?')) return;
    var url = '../ajax.php?id=' + id + '&action=delete_project_message';
    ajax.response(xml, url, delete_project_message_ed);
}
function delete_project_message_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    var project_id = $('project_id').value;
    get_project_message(project_id, 100);
}

//
function delete_brand_message(id) {
    if (!confirm('确认您要删除吗?')) return;
    var url = '../ajax.php?id=' + id + '&action=delete_project_message&type=brand';
    ajax.response(xml, url, delete_brand_message_ed);
}
function delete_brand_message_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    var project_id = $('project_id').value;
    get_brand_message(project_id, 100);
}

//
function audit_project() {
    var project_id = $('project_id').value;
    msgbox('', '<div class="loading1">请稍候...</div>', 340, 200);
    var url = '../ajax.php?project_id=' + project_id + '&action=audit_project';
    ajax.response(xml, url, audit_project_ed);
}
function audit_project_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    var project_id = $('project_id').value;
    hide_msgbox();
    msgbox('', '<div class="succeed1">谢谢你的付款!</div>', 340, 200);
    setTimeout("header('project.php?id=" + project_id + "');", 3000);
}

//
function set_full_payment() {
    var project_id = $('project_id').value;
    msgbox('', '<div class="loading1">请稍候...</div>', 340, 200);
    var url = '../ajax.php?project_id=' + project_id + '&action=set_full_payment';
    ajax.response(xml, url, audit_project_ed);
}

//
function add_work(logo, message, taocan) {
    msgbox('上传作品..', '<div class="loading1">请稍候...</div>', 340, 200);
    var project_id = $('project_id').value;
    var url = '../ajax.php?project_id=' + project_id + '&logo=' + encodeURIComponent(logo) + '&message=' + message + '&taocan=' + encodeURIComponent(taocan) + '&action=add_work';
    ajax.response(xml, url, add_work_ed);
}

function list_add_work(logo, message, taocan, pid) {
    msgbox('上传作品..', '<div class="loading1">请稍候...</div>', 340, 200);
    var project_id = pid;
    var url = '../ajax.php?project_id=' + project_id + '&logo=' + encodeURIComponent(logo) + '&message=' + message + '&taocan=' + encodeURIComponent(taocan) + '&action=add_work';
    ajax.response(xml, url, list_add_work_ed);
}
function add_work_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    if (html.indexOf("succeed") != -1) {
        msgbox('上传作品..', '<div class="succeed1">提交成功!</div>', 340, 200);
        setTimeout("hide_msgbox();", 1500);
        var work_count = $('work_count').innerHTML;
        $('work_count').innerHTML = ++work_count;
        var project_id = $('project_id').value;
        var page = $('page').value;
        get_works(project_id, page);
    } else {
        msgbox('提交作品..', '<div class="error1">' + html + '</div>', 340, 200);
    }
}

function list_add_work_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    if (html.indexOf("succeed") != -1) {
        msgbox('上传作品..', '<div class="succeed1">提交成功!</div>', 340, 200);
        setTimeout(function () {
            window.location.href = "project.php?id=" + jQuery('#cur_project_id').val();
        }, 1500);
    } else {
        msgbox('提交作品..', '<div class="error1">' + html + '</div>', 340, 200);
    }
}

//
function add_work_design(logo, message, taocan) {
    msgbox('上传作品..', '<div class="loading1">请稍候...</div>', 340, 200);
    var project_id = $('project_id').value;
    var url = '../ajax.php?project_id=' + project_id + '&logo=' + encodeURIComponent(logo) + '&message=' + message + '&taocan=' + encodeURIComponent(taocan) + '&action=add_work';
    ajax.response(xml, url, add_work_design_ed);
}
function add_work_design_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    if (html.indexOf("succeed") != -1) {
        msgbox('上传作品..', '<div class="succeed1">提交成功!</div>', 340, 200);
        //get_user_works($j('#user_id').val(),($j('#show_all_designs').attr('lang') == 1)?0:1,0,$j('.tabs1 .active').attr('rel'));
        setTimeout("hide_msgbox();window.location.reload();", 1500);
    } else {
        msgbox('提交作品..', '<div class="error1">' + html + '</div>', 340, 200);
    }
}

//
function add_work_cover(logo) {
    msgbox('上传作品..', '<div class="loading1">请稍候...</div>', 340, 200);
    var url = '../ajax.php?logo=' + encodeURIComponent(logo) + '&action=add_cover';
    ajax.response(xml, url, add_work_cover_ed);
}
function add_work_cover_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    if (html.indexOf("succeed") != -1) {
        msgbox('个人广告牌', '<div class="succeed1">提交成功!</div>', 340, 200);
        setTimeout("winreload();", 1500);
    } else {
        msgbox('个人广告牌', '<div class="error1">' + html + '</div>', 340, 200);
    }
}


//
function get_works(project_id, page) {
    var url = '/Employer/TaskInfo?id=' + project_id + '&page=' + page + '&action=get_works';
    //ajax.response(ajax_works,url,get_works_ed);
    ajax_works(url, get_works_ed);
}
function get_works_ed(html) {
    //var html = ajax.request(ajax_works);
    if (typeof (html) == 'undefined') return;
    $j.fn.colorbox.close();
    $('works_list').innerHTML = html;
    search_winning();
}

function get_works_vipdesign(project_id, page) {
    var url = '../ajax_page.php?project_id=' + project_id + '&page=' + page + '&action=get_works_vipdesign';
    ajax.response(ajax_works, url, get_works_ed);
}

//
function search_winning() {
    var works = $tag($('works_list'), 'img');
    var len = works.length;
    var px = 'px';
    for (var i = 0; i < len; i++) {
        var img = works[i];
        if (img.lang == 'winning') {
            var div = '<div class="winning_logo" style="position:absolute;display:block;"></div>';
            img.parentNode.innerHTML = div + img.parentNode.innerHTML;
            /* var pos = new getPos(img);
             var _left = pos.x+1;
             var _top = pos.y+1;
             with($('winning_logo').style){
              position = 'absolute';display = 'block';
              left = _left+px;top = _top+px;
             }*/
        }
    }
}

//
function work_start(work_id, designer_id, user_name, designer_level, work_number, logo, score, has_finalist, winning, user_info, work_message, reply, taocan) {
    var cookie_user_id = $('cookie_user_id').value;
    var client_id = $('client_id').value;
    var project_status = parseInt($('project_status').value);
    //var finalist = parseInt($('finalist').value);
    //var finalist_count = parseInt($('finalist_count').value);
    var designerid = parseInt($('designerid').value)
    var CanSelectEnter = parseInt($('CanSelectEnter').value);
    var pay_type = parseInt($('pay_type').value);
    has_finalist = parseInt(has_finalist);
    winning = parseInt(winning);

    if (taocan < 10) {
        _h = 250; _w = 330;
    } else if (taocan < 30) {
        _h = 600; _w = 500;
    } else if (taocan < 40) {
        _h = 450; _w = 800;
    } else if (taocan < 50) {
        _h = 960; _w = 800;
    }


    var html = "";
    var user_info_html = "";
    var user_info_html_default = "";

    if (cookie_user_id == client_id) {
        (winning == 1) ? (winning_checked = "checked", winning_disabled = "disabled") : (winning_checked = "", winning_disabled = "");
        var message_default = '给这个作品留言...';

        var array = user_info.split(',');
        var qq = array[0];
        var phone = array[1];
        user_info_html = user_name + "：<img src='/images/qq.gif' align='absmiddle' /> " + qq + "　";
        user_info_html += "<img src='/images/mobile.gif' align='absmiddle' />" + phone;
        user_info_html = "<div class='div44'>" + user_info_html + "</div>";

        if (has_finalist > 0) user_info_html_default = user_info_html;

        var operating_html = "";
        var default_operating_html = "<div class='hr1'></div><div class='div4'></div><div class='div44'><div class='div5'><textarea id='work_message' lang='" + message_default + "' class='text_area3' onfocus=\"if(this.value==this.lang)this.value='';\" onblur=\"if(this.value=='')this.value=this.lang;\">" + message_default + "</textarea></div><div class='div9'></div><div class='left5'><table><tr><td><input type='button' id='work_btn' class='btn' lang='" + work_id + "' value='发 送' onClick=\"modify_work();\" /></td><td><input type='button' class='btn' value='关 闭' onClick=\"$j.fn.colorbox.close();\" /></td></tr></table></div><div class='right5'><label><input type='checkbox' id='winning' " + winning_checked + " " + winning_disabled + " onclick=\"check_pay_type();\" />选择成为中标作品</label></div><div class='clear'></div></div>";

        if (project_status == 2) {

            if (pay_type == 0) {

                operating_html = "<div class='fine-tuning alert'><span>请完成您的项目余款后联系设计师继续修改完善您的标志设计</span></div>";
            } else {

                if (has_finalist == 1) {

                    operating_html = default_operating_html;
                } else {

                    if (CanSelectEnter == 0) {//还有设计师在修稿,只能留言
                        operating_html = "<div class='hr1'></div><div class='div4'></div><div class='div44'><div class='div5'><textarea id='work_message' lang='" + message_default + "' class='text_area3' onfocus=\"if(this.value==this.lang)this.value='';\" onblur=\"if(this.value=='')this.value=this.lang;\">" + message_default + "</textarea></div><div class='div9'></div><div class='left5'><table><tr><td><input type='button' id='work_btn' class='btn' lang='" + work_id + "' value='发 送' onClick=\"modify_work();\" /></td><td><input type='button' class='btn' value='关 闭' onClick=\"$j.fn.colorbox.close();\" /></td></tr></table></div><div class='right5'></div><div class='clear'></div></div>"
                    }
                    else { //没有设计师修稿
                        if (designer_id != designerid) { //如果当前设计师不是入围设计师则:1 可入围,2 直接中标
                            // operating_html = "<div id='init_operating' class='div42'><br><div class='div5'>您还可以选择 <b class='red'>"+(finalist-finalist_count)+"</b>名设计师 入围<br />是否选择"+user_name+"入围，帮您继续完善标志设计?<br></div><br><div class='div8'><a href='#' class='btn btn-success mr1' onClick=\"setDisplay('init_operating','none');setDisplay('operating','block');$('into_finalist').value = 1;jQuery.fn.colorbox.resize();return false;\"> 选择"+user_name+"入围 </a><input type='button' class='btn' value='取消' onClick=\"$j.fn.colorbox.close();\" /></div></div><div class='div7'></div><div id='operating' class='hidden'>"+user_info_html_default+default_operating_html+"</div>";
                            operating_html = "<div id='init_operating' class='div42'><br>是否选择" + user_name + "入围，帮您继续完善标志设计?<br></div><br><div class='div8'><a href='#' class='btn btn-success mr1' onClick=\"modify_go_finalist(" + work_id + ",1);return false;\"> 选择" + user_name + "入围 </a><input type='button' class='btn' value='取消' onClick=\"$j.fn.colorbox.close();\" /></div></div><div class='div7'></div><div id='operating' class='hidden'>" + user_info_html_default + default_operating_html + "</div><div class='hr1'></div><div class='div4'></div><div class='div44'><div class='div5'><textarea id='work_message' lang='" + message_default + "' class='text_area3' onfocus=\"if(this.value==this.lang)this.value='';\" onblur=\"if(this.value=='')this.value=this.lang;\">" + message_default + "</textarea></div><div class='div9'></div><div class='left5'><table><tr><td><input type='button' id='work_btn' class='btn' lang='" + work_id + "' value='发 送' onClick=\"modify_work();\" /></td><td><input type='button' class='btn' value='关 闭' onClick=\"$j.fn.colorbox.close();\" /></td></tr></table></div><div class='right5'><label><input type='checkbox' id='winning' " + winning_checked + " " + winning_disabled + " onclick=\"check_pay_type();\" />选择成为中标作品</label></div><div class='clear'></div></div>";
                        }
                        else {//如果当前设计师是入围设计师: 直接中标
                            operating_html = "<div class='hr1'></div><div class='div4'></div><div class='div44'><div class='div5'><textarea id='work_message' lang='" + message_default + "' class='text_area3' onfocus=\"if(this.value==this.lang)this.value='';\" onblur=\"if(this.value=='')this.value=this.lang;\">" + message_default + "</textarea></div><div class='div9'></div><div class='left5'><table><tr><td><input type='button' id='work_btn' class='btn' lang='" + work_id + "' value='发 送' onClick=\"modify_work();\" /></td><td><input type='button' class='btn' value='关 闭' onClick=\"$j.fn.colorbox.close();\" /></td></tr></table></div><div class='right5'><label><input type='checkbox' id='winning' " + winning_checked + " " + winning_disabled + " onclick=\"check_pay_type();\" />选择成为中标作品</label></div><div class='clear'></div></div>";
                        }
                    }
                }
            }
        } else if (project_status == 3) {
            if (winning == 1) {
                operating_html = default_operating_html;
            }
        } else if (project_status == 4) {
            operating_html = "<div class='div4'>评分:</div><div><label><input type='radio' name='rankscroe' value='1'>非常不满意</label><label><input type='radio' name='rankscroe' value='2'>不满意</label><label><input type='radio' name='rankscroe' value='3'>比较满意</label><label><input type='radio' name='rankscroe' value='4' checked='checked'>满意</label><label><input type='radio' name='rankscroe' value='5'>很满意</label><div class='div4'>评分说明:</div><textarea id='rankexplain'></textarea><br/><input type='button' id='work_btn' class='btn' lang='" + work_id + "' value='评 分' onClick=\"rank();\" /></div>"
        }
        else {//投稿期 不能操作

            operating_html = "";
        }
        html = "<div style='width:" + _w + "px;'><img src='" + logo + "' width='" + _w + "' onerror=\"if(application.isFF)this.src='/images/no_photo.gif';\" /><div class='div7'></div><div class='left4'>#<span class='font13'>" + work_number + "</span> by <span class='font16'>" + user_name + "</span></div><div class='right4'></div><div class='clear'></div>" + user_info_html_default + "<div class='hr1'></div><div class='div7'></div>" + work_message + "<div class='div7'></div><input type='hidden' id='work_user_name' value='" + user_name + "' /><input type='hidden' id='into_finalist' />" + operating_html + "</div>";
    } else {
        var delete_html = "";
        var reply_html = "";
        if (cookie_user_id == designer_id) delete_html = "<label><a href='#' onclick=\"delete_work('" + work_id + "');return false;\"><img src='/images/delete.gif' align='absbottom' />删除</a></label>";
        if (reply == 1) {
            reply_html = "<div class='div8'><a href='#' onClick=\"show_hide('work_message_box');return false;\">回复</a></div><div class='div7'></div><div id='work_message_box' class='hidden'><textarea id='work_message' class='text_area3'></textarea><input type='button' id='work_message_btn' class='btn' value=' OK ' onClick=\"send_work_message();\" /></div><br><div class='div8'><input type='button' id='work_btn' class='btn' lang='" + work_id + "' value='Cancel' onClick=\"$j.fn.colorbox.close();\" />";
        }
        html = "<div style='width:" + _w + "px;'><img src='" + logo + "' width='" + _w + "' onerror=\"if(application.isFF)this.src='/images/no_photo.gif';\" /><div class='div7'></div><div class='left4'>#<span class='font13'>" + work_number + "</span> by <span class='font16'>" + user_name + "</span><img src='/images/level_" + designer_level + ".gif' class='img2' align='absmiddle' /></div><div class='right4'><span class='font14'>" + delete_html + "</span></div><div class='clear'></div>" + work_message + reply_html + "</div>";
    }
    $j.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", html: html });
}

function rank() {

    var work_id = $('work_btn').lang;
    if (empty(work_id)) return;
    
    var scroe = jQuery(":radio[name='rankscroe']:checked").val();
    var rankexplain = $('rankexplain').value;
    
    var url = '/Employer/Rank?id=' + work_id + '&rankscore=' + scroe + '&explain=' + rankexplain;
    jQuery.ajax({
        url: url,
        dataType: "text",
        type: "POST",
        success: function (txt) {
            if (txt == 'succeed') {
                $j.fn.colorbox.close();
                setTimeout("winreload()", 1000);
            }
            else {
                alert(txt);
            }
                
        }
    });
}

//直接选择入围
function modify_go_finalist(work_id, into_finalist) {
    jQuery.ajax({
        type: 'POST',
        url: '/Employer/SelectEnter',
        data: 'id=' + work_id + '&into_finalist=' + into_finalist + '&action=modify_go_finalist',
        success: function (html) {
            if (html == 'succeed') {
                setTimeout("winreload()", 1000);
            }
        },
        failure: function () { }
    });
}
//直接选择入围
function ajax_works(url, func) {
    jQuery.ajax({
        type: 'GET',
        url: url,
        //data: 'id=' + work_id + '&into_finalist=' + into_finalist + '&action=modify_go_finalist',
        success: func,
        failure: function () { }
    });
}
//
function check_pay_type() {
    var pay_type = $('pay_type').value;
    pay_type = parseInt(pay_type);
    if (pay_type == 1) return;
    alert('请先完成项目余款后再选择中标作品!');
    $('winning').checked = false;
}

//
function modify_work() {

    var work_id = $('work_btn').lang;
    if (empty(work_id)) return;
    var winning; ($('winning') && $('winning').checked) ? winning = 1 : winning = 0;
    var message = $('work_message').value;
    var message_default = $('work_message').lang;
    var into_finalist = $('into_finalist').value;
    if (message == message_default) message = '';
    if (into_finalist == 1) {
        var finalist = parseInt($('finalist').value);
        var finalist_count = parseInt($('finalist_count').value);
        var finalist_users = $('finalist_users').innerHTML;
        var work_user_name = $('work_user_name').value;
        (finalist_count == 0) ? finalist_users = work_user_name : finalist_users += ", " + work_user_name;
        $('finalist_users').innerHTML = finalist_users;
        $('finalist_count').value = ++finalist_count;
    }
    if (!is_numeric(winning)) winning = 0;
    if (winning == 1 && !$('winning').disabled && !confirm('确认您要选择该作品中标吗?\n\n选定中标作品后您的项目将立即结束.\n\n但是您将仍然可以继续和中标设计师继续完成相应的修改.')) return;
    $('work_btn').disabled = true;
    $('work_btn').value = '发 送...';
    var url = '/Employer/ModifyContr?id=' + work_id + '&winning=' + encodeURIComponent(winning) + '&message=' + message + '&into_finalist=' + into_finalist + '&action=modify_work';
    ajax.response(xml, url, modify_work_ed);
}
function modify_work_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    $('work_btn').disabled = false;
    $('work_btn').value = '发 送';
    if (html.indexOf('succeed') != -1) {
        $j.fn.colorbox.close();
        var project_id = $('project_id').value;
        var page = $('page').value;
        //get_works(project_id,page);
        setTimeout("winreload()", 1000);
    } else {
        showmsg('msg', 'error', html);
    }
}

//
function pass_work(work_id) {
    if (!confirm('确认您对该设计不感兴趣吗 ?')) return;
    var url = '../ajax.php?work_id=' + work_id + '&score=-1&winning=0&message=&into_finalist=0&action=modify_work';
    ajax.response(xml, url, close_work);
}

//
function close_work() {
    var project_id = $('project_id').value;
    var page = $('page').value;
    get_works(project_id, page);
}

//
function delete_work(work_id) {
    if (empty(work_id)) return;
    if (!confirm('确认您要删除吗?')) return;
    msgbox('删除', '<div class="loading1">正在删除...</div>', 340, 200);
    var url = '../ajax.php?id=' + work_id + '&action=delete_work';
    ajax.response(xml, url, delete_work_ed);
}
function delete_work_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    $j.fn.colorbox.close();
    if (html.indexOf("succeed") != -1) {
        msgbox('删除', '<div class="succeed1">完成</div>', 340, 200);
        setTimeout('hide_msgbox();', 1500);
        var work_count = $('work_count').innerHTML;
        $('work_count').innerHTML = --work_count;
        var project_id = $('project_id').value;
        var page = $('page').value;
        get_works(project_id, page);
    } else {
        msgbox('删除', '<div class="error1">' + html + '</div>', 340, 200);
        setTimeout('hide_msgbox();', 2000);
    }
}

function delete_work_design(work_id) {
    if (empty(work_id)) return;
    if (!confirm('确认您要删除吗?')) return;
    msgbox('删除', '<div class="loading1">正在删除...</div>', 340, 200);
    var url = '../ajax.php?id=' + work_id + '&action=delete_work';
    ajax.response(xml, url, delete_work_design_ed);
}
function delete_work_design_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    $j.fn.colorbox.close();
    if (html.indexOf("succeed") != -1) {
        msgbox('删除', '<div class="succeed1">完成</div>', 340, 200);
        setTimeout('hide_msgbox();', 1500);
        get_user_works($j('#user_id').val(), $j('#show_all_designs').attr('lang'), 0, $j('.tabs1 .active').attr('rel'));
    } else {
        msgbox('删除', '<div class="error1">' + html + '</div>', 340, 200);
        setTimeout('hide_msgbox();', 2000);
    }
}

//
function send_work_message() {
    var work_id = $('work_btn').lang;
    var message = $('work_message').value;
    if (empty(message)) { $('work_message').focus(); return; }
    $('work_message_btn').disabled = true;
    $('work_message_btn').value = 'Wait...';
    var url = '../ajax.php?work_id=' + work_id + '&message=' + message + '&action=send_work_message';
    ajax.response(xml, url, send_work_message_ed);
}
function send_work_message_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    $j.fn.colorbox.close();
    if (html.indexOf("succeed") != -1) {
        var project_id = $('project_id').value;
        var page = $('page').value;
        get_works(project_id, page);
    } else {
        msgbox('消息', '<div class="error1">' + html + '</div>', 340, 200);
        setTimeout('hide_msgbox();', 2000);
    }
}

//
function delete_work_message(id) {
    if (!confirm('确认您要删除吗?')) return;
    var url = '../ajax.php?id=' + id + '&action=delete_work_message';
    ajax.response(xml, url, send_work_message_ed);
}

//
function add_package(package) {
    msgbox('上传包文件', '<div class="loading1">请稍候...</div>', 340, 200);
    var project_id = $('project_id').value;
    var url = '../ajax.php?project_id=' + project_id + '&package=' + encodeURIComponent(package) + '&action=add_package';
    ajax.response(xml, url, package_ed);
}
function package_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    if (html.indexOf("succeed") != -1) {
        msgbox('', '<div class="succeed1">操作成功!</div>', 340, 200);
        setTimeout("winreload();", 1500);
    } else {
        msgbox('', '<div class="error1">' + html + '</div>', 340, 200);
    }
}

//确认打包文件
function confirm_package() {
    if (!confirm('当您确认收到打包文件后, 该设计项目将正式结束.\n\n我们将会给中标的设计者发放相应的设计奖金. 确认您收到打包文件了吗?')) return;
    msgbox('确认打包文件..', '<div class="loading1">请稍候...</div>', 340, 200);
    var project_id = $('project_id').value;
    var url = '../ajax.php?project_id=' + project_id + '&action=confirm_package';
    ajax.response(xml, url, comfirm_package_ed);
}

function comfirm_package_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    if (html.indexOf("succeed") != -1) {
        //msgbox('','<div class="succeed1">操作成功!</div>',340,200);
        //setTimeout("winreload();",1500);
        var project_id = $('project_id').value;
        var url = '../ajax.php?id=' + project_id + '&action=show_designer_comment';
        ajax.response(xml, url, show_designer_ed);
    } else {
        msgbox('', '<div class="error1">' + html + '</div>', 340, 200);
    }
}

function show_designer_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    msgbox('给设计师服务评价', html, 420, 20);
}

//分数低于4分
function lt(score, id) {
    var comment_des = new Array("0", "很不满意", "不满意", "一般", "满意", "很满意");
    //分数低于4分
    if (score < 4) {
        if ($('comment_content_' + id).value == $j('#default_' + id).val()) {
            $j('#comment_content_' + id).addClass('red');
            $('comment_content_' + id).value = '我们非常重视设计服务质量，请告诉我们您对 ' + $('hidden_user_name_' + id).value + ' 设计师服务感到 ' + comment_des[score] + ' 的主要原因。';
        }
        $j('#default_' + id).val('我们非常重视设计服务质量，请告诉我们您对 ' + $('hidden_user_name_' + id).value + ' 设计师服务感到 ' + comment_des[score] + ' 的主要原因。');
    }
    if (score >= 4) {
        $j('#comment_content_' + id).removeClass('red');
        if ($('comment_content_' + id).value == $j('#default_' + id).val()) {
            $('comment_content_' + id).value = "请对 " + $('hidden_user_name_' + id).value + " 的服务进行评价";
        }
        $j('#default_' + id).val("请对 " + $('hidden_user_name_' + id).value + " 的服务进行评价");
    }
}

//确认打包后给设计师评分
function giveComment() {
    var user_ids = "1,2";// $('hidden_user_ids').value;
    var project_id = $('project_id').value;
    var user_id_array = user_ids.split(",");
    var url = '../ajax.php?action=deal_designer_comment&num=' + user_id_array.length + '&client_id=' + $('client_id').value + "&project_id=" + project_id;
    for (i = 0; i < user_id_array.length; i++) {
        //判断是否打分
        if ($('hidden_comment_' + user_id_array[i]).value == '') { setDisplay('comment_msg', ''); showmsg('comment_msg', 'error4', '请给 ' + $('hidden_user_name_' + user_id_array[i]).value + ' 设计师打分。'); return; };
        //小于4分是否评价
        if ($('hidden_comment_' + user_id_array[i]).value < 4 && $('comment_content_' + user_id_array[i]).value == $('default_' + user_id_array[i]).value) {
            setDisplay('comment_msg', ''); showmsg('comment_msg', 'error4', '请填写原因！'); return;
        }
        url += '&id' + i + '=' + user_id_array[i] + '&comment' + i + '=' + $('hidden_comment_' + user_id_array[i]).value + '&content' + i + '=' + encodeURIComponent($('comment_content_' + user_id_array[i]).value) + '&user_name' + i + '=' + encodeURIComponent($('hidden_user_name_' + user_id_array[i]).value);

    }
    $j('#comment_btn').attr("disabled", true);
    setDisplay('comment_msg', '');
    showmsg('comment_msg', 'loading', 'Waiting...');
    ajax.response(xml, url, giveComment_ed);
}

function giveComment_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    //$('comment_btn').disabled = false;
    showmsg('comment_msg', 'succeed', html);
    setTimeout("winreload();", 1500);
}

//
function scroll_page_top() {
    var pos = new getPos($('page_top'));
    var scrollTop = pos.y;
    window.scrollTo(0, scrollTop);
}

//
function send_package_message() {
    var project_id = $('project_id').value;
    var message = $('package_message').value;
    if (empty(message) || message.indexOf('(雇主)') != -1 || message.indexOf('(中标设计师)') != -1 || message.indexOf('(他们)') != -1) { $('package_message').focus(); return; }
    $('package_message_btn').disabled = true;
    $('package_message_btn').innerHTML = '请稍候...';
    var url = '../ajax.php?project_id=' + project_id + '&message=' + message + '&action=send_package_message';
    ajax.response(xml, url, send_package_message_ed);
}
function send_package_message_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    $('package_message_btn').disabled = false;
    $('package_message_btn').innerHTML = '提交';
    if (html.indexOf("succeed") != -1) {
        $('package_message').value = '';
        var id = $('project_id').value;
        get_package_message(id, 100);
    } else {
        msgbox('', '<div class="error1">' + html + '</div>', 340, 200);
        setTimeout("hide_msgbox();", 2000);
    }
}

//
function get_package_message(project_id, page) {
    var url = '../ajax_page.php?project_id=' + project_id + '&page=' + page + '&action=get_package_message';
    ajax.response(ajax_package_message, url, get_package_message_ed);
}
function get_package_message_ed() {
    var html = ajax.request(ajax_package_message);
    if (typeof (html) == 'undefined') return;
    $('package_message_list').innerHTML = html;
}

//
function delete_package_message(id) {
    if (!confirm('确认您要删除吗?')) return;
    var url = '../ajax.php?id=' + id + '&action=delete_project_message';
    ajax.response(xml, url, delete_package_message_ed);
}
function delete_package_message_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    var project_id = $('project_id').value;
    get_package_message(project_id, 0);
}

//
function feedback() {
    var email = $('email').value;
    var user_name = $('user_name').value;
    var phone = $('phone').value;
    var content = $('content').value;
    if (empty(user_name)) { showmsg('msg', 'error', 'Please enter your name'); return; }
    if (!is_email(email)) { showmsg('msg', 'error', 'Incorrect Email'); return; }
    if (empty(content)) { showmsg('msg', 'error', 'Please enter your comment'); return; }
    $('btn').disabled = true;
    showmsg('msg', 'loading', 'Waiting...');
    var url = '../ajax.php?email=' + encodeURIComponent(email) + '&user_name=' + encodeURIComponent(user_name) + '&phone=' + encodeURIComponent(phone) + '&content=' + encodeURIComponent(content) + '&action=feedback';
    ajax.response(xml, url, feedback_ed);
}
function feedback_ed() {
    var html = ajax.request(xml);
    showmsg('msg', 'succeed', 'Succeed!');
    setTimeout("header('index.php')", 1500);
}

//
function prompt_(message) {
    msgbox("标志123", message + "<br><div class='div8'><input type='button' class='btn' value='关闭' onClick=\"hide_msgbox();\" /></div>", 340, 200);
}

//
function pay_balance() {
    var html = $('client_payment_html').innerHTML;
    msgbox('付款方式', html, 500, 100);
}

//
function show_designer_tips(work_id, user_id, user_name, qq, msn, phone) {
    var pay_type = $('pay_type').value;
    if (pay_type == 0) return;
    var obj = 'work_user_' + work_id;
    var logo_obj = 'work_' + work_id;
    var work_tips = 'work_tips';
    var user_name = $(obj).innerHTML;
    var pos = new getPos($(logo_obj));
    var px = 'px';
    var _left = pos.x;
    var _top = pos.y + $(logo_obj).offsetHeight - 3;
    with ($(work_tips).style) {
        position = 'absolute'; display = 'block';
        left = _left + px; top = _top + px;
    }
    $(work_tips).onmousemove = function () { setDisplay('work_tips', 'block'); }
    $(work_tips).onmouseout = function () { setDisplay('work_tips', 'none'); }
    $('logo_img_' + work_id).onmouseout = function () { setDisplay('work_tips', 'none'); }

    var html = "<img src='/images/qq.gif' align='absmiddle' /> " + qq + "<br>";
    if (!empty(msn)) html += "<img src='/images/msn.gif' align='absmiddle' /> " + msn + "<br>";
    html += "<img src='/images/mobile.gif' align='absmiddle' /> " + phone;
    $(work_tips).innerHTML = html;
}

//
function get_notice() {
    var url = '../ajax.php?action=get_notice';
    ajax.response(xml, url, get_notice_ed);
}
function get_notice_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined' || empty(html)) return;
    if (html.indexOf("succeed") != -1) {
        var array = html.split('|');
        var subject = array[0];
        var content = array[1];
        msgbox(subject, '<div>' + content + '</div><div class="div8"><input type="button" class="btn" value="关闭" onclick=\"hide_msgbox();\" /></div>', 650, 80);
    }
}

//
function post_thread(subject, message) {
    var url = 'forum/posting.php?subject=' + subject + '&message=' + message + '&f=5&de=no&post=submit&mode=post';
    ajax.response(xml, url, null);
}

//
function view_message(message_id) {
    var subject = $('subject_' + message_id).value;
    var content = $('content_' + message_id).value;
    msgbox(subject, '<div>' + content + '</div><div class="div8"><input type="button" class="btn" value="关闭" onclick=\"hide_msgbox();\" /></div>', 650, 50);
    $('title_' + message_id).className = '';
    $('read_text_' + message_id).innerHTML = "<span disabled>已读</span>";
    set_message_read(message_id);
}

//
function set_message_read(message_id) {
    var url = '../ajax.php?message_id=' + encodeURIComponent(message_id) + '&action=set_message_read';
    ajax.response(xml, url, null);
}

//
function set_message_read_batch(read) {
    var message_ids = select_all();
    if (empty(message_ids)) return;
    msgbox('', '<div class="loading1">Waiting...</div>', 340, 200);
    var url = '../ajax.php?message_ids=' + encodeURIComponent(message_ids) + '&read=' + read + '&action=set_message_read_batch';
    ajax.response(xml, url, winreload);
}

//
function send_mail() {
    var url = '../ajax.php?action=send_mail';
    showmsg('msg', 'loading', '正在发送邮件...');
    ajax.response(ajax_email, url, send_mail_ed);
}
function send_mail_ed() {
    var html = ajax.request(ajax_email);
    if (typeof (html) == 'undefined' || empty(html)) return;
    showmsg('msg', 'succeed', html + '<br>发送成功');
}

/**
 * 发送汇款信息 农行
 */
function ajax_send_message_n(phone, id) {
    var url = '../ajax.php?action=send_message&type=1&phone=' + encodeURIComponent(phone) + '&id=' + id;
    showmsg('msg_n', 'loading', '正在发送短信...');
    document.getElementById('btn_n').style.display = 'none';
    if (box = document.getElementById('box_content')) {
        box.innerHTML = $('client_payment_html').innerHTML;
    }
    ajax.response(xml, url, send_message_edn);
}
/**
 * 发送汇款信息 农行
 */
function ajax_send_message_n_loop(phone, id, msgid) {
    showmsgjquery('msg_n_' + msgid, 'loading', '正在发送短信...');
    document.getElementById('btn_n_' + msgid).style.display = 'none';
    jQuery.ajax({
        type: 'POST',
        url: '../ajax.php',
        data: 'action=send_message&type=1&phone=' + encodeURIComponent(phone) + '&id=' + id,
        success: function (html) {
            if (html == 'succeed') {
                showmsgjquery('msg_n_' + msgid, 'succeed', '短信发送成功。');
            } else {
                showmsgjquery('msg_n_' + msgid, 'error', '发送失败。');
            }
        }
    });
}
function send_message_edn() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    if (html.indexOf("succeed") != -1) {
        showmsg('msg_n', 'succeed', '短信发送成功。');
    }
    else { showmsg('msg_n', 'error', '发送失败'); }
    if (box = document.getElementById('box_content')) {
        box.innerHTML = $('client_payment_html').innerHTML;
    }
}

/**
 * 发送汇款信息 招行
 */
function ajax_send_message_z(phone, id) {
    var url = '../ajax.php?action=send_message&type=2&phone=' + encodeURIComponent(phone) + '&id=' + id;
    showmsg('msg_z', 'loading', '正在发送短信...');
    document.getElementById('btn_z').style.display = 'none';
    if (box = document.getElementById('box_content')) {
        box.innerHTML = $('client_payment_html').innerHTML;
    }
    ajax.response(xml, url, send_message_edz);
}
/**
 * 发送汇款信息 招行
 */
function ajax_send_message_z_loop(phone, id, msgid) {
    //var url = '../ajax.php?action=send_message&type=2&phone='+encodeURIComponent(phone)+'&id='+id;
    showmsgjquery('msg_z_' + msgid, 'loading', '正在发送短信...');
    document.getElementById('btn_z_' + msgid).style.display = 'none';
    jQuery.ajax({
        type: 'POST',
        url: '../ajax.php',
        data: 'action=send_message&type=2&phone=' + encodeURIComponent(phone) + '&id=' + id,
        success: function (html) {
            if (html == 'succeed') {
                showmsgjquery('msg_z_' + msgid, 'succeed', '短信发送成功。');
            } else {
                showmsgjquery('msg_z_' + msgid, 'error', '发送失败。');
            }
        }
    });
}
function send_message_edz() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    if (html.indexOf("succeed") != -1) {
        showmsg('msg_z', 'succeed', '短信发送成功。');
    }
    else { showmsg('msg_z', 'error', '发送失败'); }
    if (box = document.getElementById('box_content')) {
        box.innerHTML = $('client_payment_html').innerHTML;
    }
}

//收藏
function addfavorite() {
    var url = 'http://www.logo123.net';
    var title = '标志123';
    if (document.all) {
        window.external.addFavorite(url, title);
    }
    else if (window.sidebar) {
        window.sidebar.addPanel(title, url, "");
    }
}

//申请提现
function carry() {
    if (confirm('请确认你已经正确填写你的收款信息。 每次申请提现将扣取5元手续费。\n申请提交后佣金将在3个工作日内发出， 请及时查收。')) {
        var url = '../ajax.php?action=carry';
        ajax.response(xml, url, carry_ed);
    }
}
function carry_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    if (html.indexOf("succeed") != -1) {
        msgbox('', '<div class="succeed1">操作成功!</div>', 340, 200);
        setTimeout("winreload();", 1000);
    } else {
        msgbox('', '<div class="error1">' + html + '</div>', 340, 200);
        setTimeout("hide_msgbox();", 2000);
    }
}

//标志设计作品列表
function get_user_works(user_id, has_score, page, taocan) {
    if (typeof (taocan) == 'undefined') taocan = 1;
    var url = '../ajax_page.php?user_id=' + user_id + '&has_score=' + has_score + '&page=' + page + '&taocan=' + taocan + '&action=get_user_works';
    ajax.response(ajax_works, url, get_user_works_ed);
}
function get_user_works_ed() {
    var html = ajax.request(ajax_works);
    if (typeof (html) == 'undefined') return;
    $('works_list').innerHTML = html;
}
//后台标志设计作品列表
function get_user_works_houtai(user_id, has_score, page, taocan) {
    if (typeof (taocan) == 'undefined') taocan = 1;
    var url = '../ajax_page.php?user_id=' + user_id + '&has_score=' + has_score + '&page=' + page + '&taocan=' + taocan + '&action=get_user_works_houtai';
    ajax.response(ajax_works, url, get_user_works_houtai_ed);
}
function get_user_works_houtai_ed() {
    var html = ajax.request(ajax_works);
    if (typeof (html) == 'undefined') return;
    $('works_list').innerHTML = html;
}

//
function user_works_ed() {
    var user_id = $('user_id').value;
    var page = $('page').value;
    var has_score = $('show_all_designs').alt;
    get_user_works(user_id, has_score, page, $j('.tabs1 .active').attr('rel'));
}

//
function user_work_start(work_id, logo, winning, work_message) {
    var img = new Image();
    img.src = $j('#logo_img_' + work_id).attr("src");

    var html = "<img src='" + logo + "' onerror=\"if(application.isFF)this.src='/images/no_photo.gif';\" /><div class='div7'></div><div style='width:" + img.width + "px'>" + work_message + "</div>";
    $j.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", html: html });
}

//编辑自我介绍
function intro_box_start() {
    var obj = 'intro_content';
    var default_value = $(obj).lang;
    var intro = $(obj).value;
    if (empty(intro) || intro == 'My intro...') $(obj).value = default_value;
    $(obj).onfocus = function () { if (this.value == default_value) this.value = ""; };
    $(obj).onblur = function () { if (this.value == "") this.value = default_value; };
    show_hide('intro_box');
}

//
function mofify_website() {
    var website = $('website').value;
    if (website == '我的主页...') { $('website').focus(); return; }
    var url = '../ajax.php?website=' + encodeURIComponent(website) + '&action=modify_website';
    ajax.response(xml, url, null);
    $('website_text').innerHTML = website;
    setDisplay('website_box', 'none');
}

//修改自我介绍
function modify_intro() {
    var intro = $('intro_content').value;
    var default_value = $('intro_content').lang;
    if (intro == default_value) { $('intro_content').focus(); return; }
    var url = '../ajax.php?intro=' + encodeURIComponent(intro) + '&action=modify_intro';
    ajax.response(xml, url, null);
    $('intro').innerHTML = nl2br(intro);
    setDisplay('intro_box', 'none');
}

//
function show_all_designs(has_score) {
    var obj = 'show_all_designs';
    var user_id = $('user_id').value;
    var page = $('page').value;
    $(obj).alt = has_score;
    if (has_score == 1) {
        $(obj).innerHTML = '查看';
        $(obj).lang = 0;
    } else {
        $(obj).innerHTML = '编辑';
        $(obj).lang = 1;
    }
    get_user_works(user_id, has_score, page, $j('.tabs1 .active').attr('rel'));
    setDisplay('work_tips', 'none');
}
function show_all_designs_jhq(uid, taocan, obj) {
    jQuery(obj).html("查看");
    jQuery(obj).bind("click", function () { window.location.reload(); });
    $j('#works_list').html('');
    var opt = {
        getResource: function (index, render) {
            var id = uid;
            jQuery.ajax({
                type: "POST",
                url: "../ajax_page.php",
                data: "user_id=" + id + "&page=" + index + "&taocan=" + taocan + "&action=ajax_designer_getworks",
                success: function (html) {
                    render(html);
                }
            });
        },
        auto_imgHeight: true,
        insert_type: 1
    }
    jQuery('#works_list').waterfall(opt);
    //setDisplay('work_tips','none');
}

function changedisplaystatus(workid, hidden, obj) {
    var status = (hidden == 1) ? 0 : 1;
    jQuery.ajax({
        type: "POST",
        url: "../ajax_page.php",
        data: "work_id=" + workid + "&hidden=" + status + "&action=changworkstatus",
        success: function () {
            if (status == 0) {
                jQuery(obj).parent().prev().attr("style", "");
                jQuery(obj).attr("onclick", "changedisplaystatus(" + workid + ",0,this);");
                jQuery(obj).html("隐藏");
            } else {
                jQuery(obj).parent().prev().attr("style", "-moz-opacity:0.2;filter:Alpha(Opacity=20);opacity:0.2;");
                jQuery(obj).attr("onclick", "changedisplaystatus(" + workid + ",1,this);");
                jQuery(obj).html("显示");
            }
        }
    });
}

function show_work_tips(work_id, type) {
    var cookie_user_id = $('cookie_user_id').value;
    var user_id = $('user_id').value;
    if (cookie_user_id != user_id || $('show_all_designs').lang == 1) return;
    var logo_obj = $('work_' + work_id);
    var work_tips = $('work_tips');
    var pos = new getPos(logo_obj);
    var px = 'px';
    var _left = pos.x;
    var _top = pos.y + $('logo_img_' + work_id).parentNode.offsetHeight - 1;
    with (work_tips.style) {
        position = 'absolute'; display = 'block';
        left = _left + px; top = _top + px;
    }
    var hidden = logo_obj.lang;
    var alink;
    (parseInt(hidden) == 1) ? alink = "<a href='#' onclick=\"set_work_visibility('" + work_id + "',0);return false;\">显示</a>" : alink = "<a href='#' onclick=\"set_work_visibility('" + work_id + "',1);return false;\">隐藏</a>";
    if (type == '') alink += " <a href='#' onclick=\"delete_work_design('" + work_id + "');return false;\" class='red'>删除</a>";
    work_tips.innerHTML = "<div id='alink_" + work_id + "'>" + alink + "</div>";
}

function set_work_visibility(work_id, hidden) {
    $('alink_' + work_id).innerHTML = "Wait...";
    var url = '../ajax.php?work_id=' + work_id + '&hidden=' + hidden + '&action=set_work_visibility';
    ajax.response(xml, url, user_works_ed);
}

function add_designer_comment_start() {
    msgbox('Comments', '<div class="loading1">请稍等...</div>', 340, 200);
    var user_id = $('user_id').value;
    var url = '../ajax.php?user_id=' + user_id + '&action=add_designer_comment_start';
    ajax.response(xml, url, add_designer_comment_start_ed);
}
function add_designer_comment_start_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    if (html.indexOf("succeed") != -1) {
        var user_name = $('user_name').value;
        var default_value = "请对 " + user_name + " 设计师做评价";
        msgbox('评价', "<div class='div4'></div><textarea id='comment_content' class='text_area1' onfocus=\"if(this.value=='" + default_value + "')this.value='';\" onblur=\"if(this.value=='')this.value='" + default_value + "';\">" + default_value + "</textarea><div class='div4'></div><div class='left15'><input type='button' id='comment_btn' class='btn' value='提交' onclick=\"designer_comment('add_designer_comment');\" />　<input type='button' class='btn' value='关闭' onclick=\"hide_msgbox();\" /></div><div class='right15'><div id='comment_msg' class='msg'></div></div><div class='clear'></div>", 420, 120);
    } else {
        msgbox('评价', '<div class="error1">' + html + '</div><br><div class="div8"><input type="button" class="btn" value="关闭" onclick=\"hide_msgbox();\" /></div>', 420, 200);
    }
}

//
function add_designer_comment_start1() {
    msgbox('Comments', '<div class="loading1">请稍等...</div>', 340, 200);
    var user_id = $('user_id').value;
    var url = '../ajax.php?user_id=' + user_id + '&action=add_designer_comment_start';
    ajax.response(xml, url, add_designer_comment_start1_ed);
}
function add_designer_comment_start1_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    if (html.indexOf("succeed") != -1) {
        var user_name = $('user_name').value;
        var default_value = "请对 " + user_name + " 设计师做评价";
        msgbox('Comments', "<div class='div4'></div><label><input type='radio' id='comment1' name='comment' /> Yes</label>　<label><input type='radio' id='comment_1' name='comment' /> No</label><div class='div4'></div><textarea id='comment_content' class='text_area1' onfocus=\"if(this.value=='" + default_value + "')this.value='';\" onblur=\"if(this.value=='')this.value='" + default_value + "';\">" + default_value + "</textarea><div class='div4'></div><div class='left15'><input type='button' id='comment_btn' class='btn' value='提交' onclick=\"designer_comment('add_designer_comment');\" />　<input type='button' class='btn' value='关闭' onclick=\"hide_msgbox();\" /></div><div class='right15'><div id='comment_msg' class='msg'></div></div><div class='clear'></div>", 420, 120);
    } else {
        msgbox('Comments', '<div class="error1">' + html + '</div><br><div class="div8"><input type="button" class="btn" value="Close" onclick=\"hide_msgbox();\" /></div>', 340, 200);
    }
}

//
function get_designer_comment(user_id, page) {
    var url = '../ajax_page.php?user_id=' + user_id + '&page=' + page + '&action=get_designer_comment';
    ajax.response(ajax_user_comment, url, get_designer_comment_ed);
}
function get_designer_comment_ed() {
    //$j(".showmorecomments[name='1']").remove();
    var html = ajax.request(ajax_user_comment);
    if (typeof (html) == 'undefined') return;
    $('user_comment_list').innerHTML += html;
    //$('user_comment_list').innerHTML = html;

}

//
function designer_comment(action) {
    var user_id = $('user_id').value;
    var user_name = $('user_name').value;
    var default_value = "请对 " + user_name + " 设计师做评价";
    var comment = 0;
    var content = $('comment_content').value;
    if (empty(content) || content == default_value) { showmsg('comment_msg', 'error', '请填写你的评价'); return; }
    $('comment_btn').disalled = true;
    showmsg('comment_msg', 'loading', 'Waiting...');
    var url = '../ajax.php?user_id=' + user_id + '&comment=' + comment + '&content=' + encodeURIComponent(content) + '&action=' + action;
    ajax.response(xml, url, designer_comment_ed);
}
function designer_comment_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    $('comment_btn').disabled = false;
    if (html.indexOf("succeed") != -1) {
        showmsg('comment_msg', 'succeed', '提交成功');
        var user_id = $('user_id').value;
        get_designer_comment(user_id, 0);
        setTimeout("hide_msgbox();", 2000);
    } else {
        showmsg('comment_msg', 'error', html);
    }
}

//
function modify_designer_comment_start(comment_id, comment, content) {
    if (empty(comment_id)) return;
    var user_name = $('user_name').value;
    msgbox('评价', "<div class='div4'></div><textarea id='comment_content' class='text_area1'>" + content + "</textarea><div class='div4'></div><div class='left15'><input type='button' id='comment_btn' class='btn' value='提交' onclick=\"designer_comment('modify_designer_comment&comment_id=" + comment_id + "');\" />　<input type='button' class='btn' value='关闭' onclick=\"hide_msgbox();\" /></div><div class='right15'><div id='comment_msg' class='msg'></div></div><div class='clear'></div>", 420, 120);
}

//
function delete_designer_comment(id) {
    if (!confirm('确定要删除么 ?')) return;
    var url = '../ajax.php?id=' + id + '&action=delete_designer_comment';
    ajax.response(xml, url, delete_designer_comment_ed);
}
function delete_designer_comment_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    //var user_id = $('user_id').value;
    //get_designer_comment(user_id,0);
    window.location.reload();
}

//
function reply_designer_comment_start(comment_id) {
    var pos = new getPos($('designer_comment_' + comment_id));
    var reply_box = 'reply_box';
    var _left = pos.x;
    var _top = pos.y - 2;
    var px = 'px';
    with ($(reply_box).style) {
        position = 'absolute'; display = 'block';
        left = _left + px; top = _top + px;
    }
    $(reply_box).innerHTML = "<div class='div67' style='background:#FFFFFF; padding:5px;'><textarea id='reply_content' class='text_area5'></textarea><div class='div7'></div><input type='button' id='reply_btn' class='btn' lang='" + comment_id + "' value='提交' onclick=\"reply_designer_comment();\" />　<input type='button' class='btn' value='关闭' onclick=\"show_hide('reply_box','none');\" /></div>";
}
//
function reply_designer_comment() {
    var comment_id = $('reply_btn').lang;
    var content = $('reply_content').value;
    if (!is_numeric(comment_id) || empty(content)) return;
    $('reply_btn').disabled = true;
    $('reply_btn').value = "Wait...";
    var url = '../ajax.php?comment_id=' + comment_id + '&content=' + content + '&action=reply_designer_comment';
    ajax.response(xml, url, reply_designer_comment_ed);
}
function reply_designer_comment_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    show_hide('reply_box', 'none');
    //var user_id = $('user_id').value;
    //get_designer_comment(user_id,0);
    window.location.reload();
}

//
function delete_designer_comment_reply(id) {
    if (!confirm('确定要删除么 ?')) return;
    var url = '../ajax.php?id=' + id + '&action=delete_designer_comment_reply';
    ajax.response(xml, url, delete_designer_comment_ed);
}

//显示我的推广链接
function show_spreadcode() {
    var user_id = $('cookie_user_id').value;
    var spread_code = $('spread_code').value;
    var html = "<div>当用户通过这个链接访问你的作品页面后 不管任何时间在标志123每下一单你都将自动获得50元的佣金提成。 所以欢迎你通过签名档， 博客，论坛等形式宣传自己的作品页面获取佣金哦。</div><br/>";
    html += "<input type='text' value='http://www.logo123.net/designer.php?id=" + user_id + "&u=" + spread_code + "' style='width:97%;' onFocus='this.select()'/><br/>";
    msgbox('我的推广代码', html, 400, 120);
}

//显示我的推广记录
function show_spread_record() {
    var user_id = $('user_id').value;
    if (!user_id) {
        msgbox('错误', '<div class="error1">请先登录！</div>', 340, 200);
        setTimeout("hide_msgbox();", 2000);
    }
    else {
        msgbox('我的推广记录', "<div id='spread_list'></div>", 500, 100);
        get_spread_list(user_id, 0, 0);
    }
}

//获取推广记录
function get_spread_list(user_id, page, type) {
    var url = '../ajax_page.php?user_id=' + user_id + '&page=' + page + '&action=show_spread_record&type=' + type;
    ajax.response(xml, url, show_spread_record_ed);
}

function show_spread_record_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    $('spread_list').innerHTML = html;
}

//邀请
function invite_start(user_id, user_name) {
    $('invite_user_id').value = user_id;
    $('invite_user_name').value = user_name;
    msgbox('邀请设计师', '<div class="loading1">请稍等...</div>', 340, 200);
    var url = '../ajax.php?action=invite_start';
    ajax.response(xml, url, invite_start_ed);
}
function invite_start_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    if (html.indexOf("succeed") != -1) {
        var result, project_id, invite_count, _invite_count, projects_html, st, $rank_html;
        result = html.split('|');
        project_id = result[0];
        invite_count = parseInt(result[1]);
        _invite_count = parseInt(result[2]);
        projects_html = result[3];
        var user_name = $('invite_user_name').value;
        var cookie_user_name = $('cookie_user_name').value;
        switch (invite_count) { case 0: st = "st"; break; case 1: st = "nd"; break; case 2: st = "rd"; break; }
        rank_html = "当你邀请设计师参与你的项目，我们将优先安排被邀请的设计师来参与你的项目。（<span class='red'>您还可以邀请" + (_invite_count - invite_count) + "名设计师！</span>）<br/><span class='font15'>邀请 <span class='red'>" + user_name + "</span> 参与我的设计项目 </span>";
        $('project_id').lang = project_id;
        msgbox('邀请设计师', rank_html + "<br><textarea id='invite_message' class='text_area6' style='width:100%;height:160px;'>亲爱的 " + user_name + ",\n\n我想邀请你参加我的设计项目:\n\n" + projects_html + "谢谢,\n\n- " + cookie_user_name + "(雇主)</textarea><div class='div9'></div><div class='div5'><input type='button' class='btn' value='邀请' onclick=\"send_invite();\" />　　<input type='button' class='btn' value='关闭' onclick=\"hide_msgbox();\" /></div>", 440, 120);
    } else if (html == '1') {
        msgbox('邀请设计师', '<div style="line-height:20px;padding-bottom:8px;font-size:14px;">谢谢您的邀请！ 我是标志123的签约设计师， 请先选择您需要设计的种类，我将竭诚为您服务。 如果您有任何问题， 欢迎联系我们的<a href="http://qiao.baidu.com/?module=default&controller=webim&action=index&siteid=1222207&groupid=0&groupname=%E6%A0%87%E5%BF%97%E8%AE%BE%E8%AE%A1" style="font-size:14px;" target="_blank"><img src="/images/consultant.png" style="vertical-align:-3px;"/> 在线客服</a>。</div>我要设计：<br/>　　　<a href="../logo/add.php" style="font-size:16px;line-height:30px;">LOGO/商标 (企业形象，名片/VI等...)&gt;&gt;</a><br/>　　　<a href="../dm/add.php" style="font-size:16px;line-height:30px;">画册/海报 (宣传画册，海报DM等...)&gt;&gt;</a><br/>　　　<a href="../pkg/add.php" style="font-size:16px;line-height:30px;">产品包装 (创意包装...) &gt;&gt;</a><br/>　　　<a href="../web/add.php" style="font-size:16px;line-height:30px;">网页设计(网页美工，程序UI等...)&gt;&gt;</a><div class="div8"><input type="button" class="btn" value="关闭" onclick=\"hide_msgbox();\" /></div>', 440, 200);
    } else {
        msgbox('邀请设计师', html + '<br><div class="div8"><input type="button" class="btn" value="关闭" onclick=\"hide_msgbox();\" /></div>', 440, 200);
    }
}

//发送邀请
function send_invite() {
    var project_id = $('project_id').lang;
    var user_id = $('invite_user_id').value;
    var message = $('invite_message').value;
    if (empty(project_id) || empty(message)) return;
    hide_msgbox();
    msgbox('邀请设计师', '<div class="loading1">请稍等...</div>', 340, 200);
    var url = '../ajax.php?project_id=' + project_id + '&user_id=' + user_id + '&message=' + message + '&action=send_invite';
    ajax.response(xml, url, send_invite_ed);
}
function send_invite_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    hide_msgbox();
    if (html.indexOf('succeed') != -1) {
        msgbox('邀请设计师', '<div class="succeed1">您的邀请发送成功！</div>', 340, 200);
    } else {
        msgbox('邀请设计师', '<div class="error1">' + html + '</div>', 340, 200);
    }
    setTimeout(hide_msgbox, 2000);
}

function partner_register() {
    var email = $j('#email').val();
    var user_name = $j('#user_name').val();
    var password = $j('#pwd').val();
    email = email.toLowerCase();
    user_name = user_name.trim();
    if (empty(user_name)) { showmsg('msg', 'error', '请输入网站域名'); return; }
    if (!is_email(email)) { showmsg('msg', 'error', '请输入正确的Email'); return; }
    if (empty(password)) { showmsg('msg', 'error', '请输入你的4位数字密码'); return; }
    $j('#btn').attr("disabled", true);

    showmsg('msg', 'loading', '正在注册,请稍候...');
    var url = '../ajax.php?email=' + encodeURIComponent(email) + '&user_name=' + encodeURIComponent(user_name) + '&password=' + encodeURIComponent(password) + '&action=partner_register';
    ajax.response(xml, url, partner_register_ed);
}
function partner_register_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    if (html.indexOf("succeed") != -1) {
        showmsg('msg', 'succeed', '注册成功');
        setTimeout("winreload();", 2000);
    } else {
        $j('#btn').attr("disabled", false);
        showmsg('msg', 'error', html);
    }
}

//显示推广链接代码
function show_spread_code(id) {
    var url = '../ajax.php?id=' + id + '&action=show_spread_code';
    ajax.response(xml, url, show_spread_code_ed);
}
function show_spread_code_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    if (html.indexOf("login") != -1) {
        var content = '<table width="100%" cellspacing="0" border="0" style="background:url(../images/bg-partner-4.gif) no-repeat right bottom;"><tr><td colspan="3"></td> </tr><tr><td width="27%" height="35" align="right"><b>用户邮箱:</b>&nbsp;</td><td colspan="2"><input type="text" class="textx" id="lemail"> <span class="red"> * </span></td></tr><tr><td height="35" align="right"><b>四位数字密码:</b>&nbsp;</td><td colspan="2"><input type="password" class="textx" id="lpwd"> <span class="red"> * </span></td></tr><tr><td height="40" align="right"></td><td width="23%"><img src="../images/btn-login.gif" onclick="partner_login();" style="cursor:pointer;" id="lbtn"/></td><td><div class="msg" id="lmsg"></div></td></tr><tr><td height="20" align="right"></td><td><a href="#register" onclick="hide_msgbox()">5秒钟注册 &gt;&gt;</a></<td></td></tr></table>';
        msgbox('用户登录', content, 450, 200);
    }
    else {
        msgbox('推广代码', html, 460, 200);
    }
}

//预览推广效果
function preview_spread_code(id) {
    var url = '../ajax.php?id=' + id + '&action=preview_spread_code';
    ajax.response(xml, url, show_spread_code_ed);
}
function preview_spread_code_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    if (html.indexOf("login") != -1) {
        var content = '<table width="100%" cellspacing="0" border="0" style="background:url(../images/bg-partner-4.gif) no-repeat right bottom;"><tr><td colspan="3"></td> </tr><tr><td width="27%" height="35" align="right"><b>用户邮箱:</b>&nbsp;</td><td colspan="2"><input type="text" class="textx" id="lemail"> <span class="red"> * </span></td></tr><tr><td height="35" align="right"><b>四位数字密码:</b>&nbsp;</td><td colspan="2"><input type="password" class="textx" id="lpwd"> <span class="red"> * </span></td></tr><tr><td height="60" align="right"></td><td width="23%"><img src="../images/btn-login.gif" onclick="partner_login();" style="cursor:pointer;" id="lbtn"/></td><td><div class="msg" id="lmsg"></div></td></tr></table>';
        msgbox('用户登录', content, 450, 200);
    }
    else {
        msgbox('推广效果预览', html, 460, 200);
    }
}

//合作伙伴登录
function partner_login() {
    var email = $j('#lemail').val();
    var password = $j('#lpwd').val();
    if (!is_email(email)) { showmsg('lmsg', 'error', '请正确输入email地址'); return; }
    if (empty(password)) { showmsg('lmsg', 'error', '请输入密码'); return; }
    showmsg('lmsg', 'loading', '正在验证...');
    var url = '../ajax.php?email=' + encodeURIComponent(email) + '&password=' + encodeURIComponent(password) + '&action=partner_login';
    ajax.response(xml, url, partner_login_ed);
}
function partner_login_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    if (html.indexOf("succeed") != -1) {
        showmsg('lmsg', 'succeed', '登录成功');
        var url = get('url');
        (url) ? header(url) : setTimeout("header('/partners/index.php')", 1000);
    } else {
        showmsg('lmsg', 'error', 'email或密码错误');
    }
}

//税
function tax_show(_type, name, address, person, phone, code) {
    var del_check = '';
    var more_check = '';
    if (_type == 0) {
        del_check = 'checked="checked"';

    }
    else {
        more_check = 'checked="checked"';
    }
    var html = '<p><input type="radio" name="tax" ' + del_check + ' id="tax-1" onclick="tax_del();"/> <label for="tax-1" style="display:inline;">我不需要发票<label></p><p><input type="radio" name="tax" id="tax-2" onclick="tax_more();" onclick="tax_more();" ' + more_check + '/> <label for="tax-2" style="display:inline;">我需要发票</label></p>';
    if (_type == 1) {
        html += '<div class="div44"><b class="red">非常重要：</b> 我们将收取总金额的5%作为发票的手续费和快递费用。 您的发票将在您支付完余款后快递到您以下地址。</div>';
        html += '<p><b>请务必认真填写以下内容：</b></p><table width="100%" cellspacing="0" border="0"><tr><td width="80" height="30" align="right"><b>公司名称：</b></td><td colspan="2"><input type="text" class="textx" id="tax_name" value="' + name + '"></td></tr><tr><td height="30" align="right"><b>收票地址：</b></td><td colspan="2"><input type="text" class="textx" id="tax_address" value="' + address + '"></td></tr><tr><td height="30" align="right"><b>联系人：</b></td><td colspan="2"><input type="text" class="textx" id="tax_person" value="' + person + '"></td></tr><tr><td height="30" align="right"><b>手机：</b></td><td colspan="2"><input type="text" class="textx" id="tax_phone" value="' + phone + '"></td></tr><tr><td height="30" align="right"><b>邮编：</b></td><td colspan="2"><input type="text" class="textx" id="tax_code" value="' + code + '"></td></tr><tr><td></td><td width="80"><button onclick="tax();" class="btn btn-success" id="tax_btn">提 交</button></td><td><div class="msg" id="tax_msg"></div></td></tr></table>';
    }
    msgbox('申请开发票', html, 460, 100);
}

function tax_del() {
    var project_id = $j('#project_id').val();
    var tax_type = jQuery('#tax_type').val();
    if (typeof (tax_type) == 'undefined') tax_type = '';
    var url = '../ajax.php?project_id=' + encodeURIComponent(project_id) + '&type=' + encodeURIComponent(tax_type) + '&action=tax_del';
    ajax.response(xml, url, winreload);
}

function tax_more() {
    hide_msgbox();
    var html = '<div class="div44"><b class="red">非常重要：</b> 我们将收取总金额的5%作为发票的手续费和快递费用。 您的发票将在您支付完余款后快递到您以下地址。</div>';
    html += '<p><b>请务必认真填写以下内容：</b></p><table width="100%" cellspacing="0" border="0"><tr><td width="80" height="30" align="right"><b>公司名称：</b></td><td colspan="2"><input type="text" class="textx" id="tax_name"></td></tr><tr><td height="30" align="right"><b>收票地址：</b></td><td colspan="2"><input type="text" class="textx" id="tax_address"></td></tr><tr><td height="30" align="right"><b>联系人：</b></td><td colspan="2"><input type="text" class="textx" id="tax_person"></td></tr><tr><td height="30" align="right"><b>手机：</b></td><td colspan="2"><input type="text" class="textx" id="tax_phone"></td></tr><tr><td height="30" align="right"><b>邮编：</b></td><td colspan="2"><input type="text" class="textx" id="tax_code"></td></tr><tr><td></td><td width="80"><button onclick="tax();" class="btn btn-success" id="tax_btn">提 交</button></td><td><div class="msg" id="tax_msg"></div></td></tr></table>';
    msgbox('申请开发票', html, 460, 100);
}

function tax() {
    var project_id = $j('#project_id').val();
    var tax_name = $('tax_name').value;
    var tax_address = $('tax_address').value;
    var tax_phone = $('tax_phone').value;
    var tax_person = $('tax_person').value;
    var tax_code = $('tax_code').value;
    var tax_type = jQuery('#tax_type').val();
    if (typeof (tax_type) == 'undefined') tax_type = '';

    if (empty(tax_name)) { showmsg('tax_msg', 'error', '请输入公司名称'); return; }
    if (empty(tax_address)) { showmsg('tax_msg', 'error', '请输入收票地址'); return; }
    if (empty(tax_person)) { showmsg('tax_msg', 'error', '请输入联系人'); return; }
    if (!is_mobile(tax_phone)) { showmsg('tax_msg', 'error', '请输入正确的手机号'); return; }
    if (empty(tax_code)) { showmsg('tax_msg', 'error', '请输入邮编'); return; }
    showmsg('tax_msg', 'loading', '提交中，请稍后...');
    var url = '../ajax.php?name=' + encodeURIComponent(tax_name) + '&address=' + encodeURIComponent(tax_address) + '&person=' + encodeURIComponent(tax_person) + '&phone=' + encodeURIComponent(tax_phone) + '&code=' + encodeURIComponent(tax_code) + '&type=' + encodeURIComponent(tax_type) + '&project_id=' + encodeURIComponent(project_id) + '&action=tax';
    ajax.response(xml, url, tax_ed);
}

function tax_ed() {
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    if (html.indexOf("succeed") != -1) {
        showmsg('tax_msg', 'succeed', '提交成功');
        setTimeout("winreload()", 1000);
    } else {
        showmsg('tax_msg', 'error', '提交失败');
    }
}

/**
 * 全付款初始化
 *	_type	1-切换为全付款,0-切换为预付款
 */
function pay_init(_type) {
    var project_id = $j('#project_id').val();
    if (_type == 1) {
        _type = 0;
    }
    else {
        _type = 1;
    }
    jQuery.ajax({
        type: 'POST',
        url: 'ajax.php',
        data: 'project_id=' + encodeURIComponent(project_id) + '&action=pay_init&type=' + _type,
        success: function (html) {
            if (html == 'succeed') {
                window.location.reload();
            }
        },
        failure: function () { }
    });
}

function tip_show(obj) {
    var topValue = 0, leftValue = 0;
    var widthValue = jQuery(obj).outerWidth();
    while (obj) {
        leftValue += obj.offsetLeft;
        topValue += obj.offsetTop;
        obj = obj.offsetParent;
    }
    $j('#ask-tip').css('top', topValue - 15 - parseInt($j('#ask-tip').height()) + 'px');
    $j('#ask-tip').css('left', (leftValue - widthValue) + 'px');
    $j("#ask-tip").fadeIn();
}

function post_album_ed() {
    $('btn').disabled = false;
    var html = ajax.request(xml);
    if (typeof (html) == 'undefined') return;
    if (html.indexOf("succeed") != -1) {
        var name = $j('#name').val();
        showmsg('msg', 'succeed', '提交成功');
        project_id = html.replace(/^succeed/, '');
        setTimeout("header('project.php?id=" + project_id + "')", 2000);
    } else {
        showmsg('msg', 'error', html);
    }
}


function show_imgs(urls, obj) {
    if ($j("#show_imgs:hidden")) {
        var topValue = 0, leftValue = 0;
        while (obj) {
            leftValue += obj.offsetLeft;
            topValue += obj.offsetTop;
            obj = obj.offsetParent;
        }
        var img_arr = urls.split(",");
        var html = '';
        for (i = 0; i < img_arr.length; i++) {
            html += "<div class='img'><img src='http://www.logo123.net/" + img_arr[i] + "'/></div>";
        }
        html = '<div class="content">' + html + '<div class="clear"></div></div>';
        $j('#show_imgs').html(html);
        $j('#show_imgs').css('top', topValue - 72 + 'px');
        $j('#show_imgs').css('left', leftValue + 140 + 'px');
        $j('#show_imgs').show();
    }
}


function view_notice(message_id) {
    var subject = $('subject_' + message_id).value;
    var content = $('content_' + message_id).value;
    msgbox(subject, '<div>' + content + '</div><div class="div8"><input type="button" class="btn" value="关闭" onclick=\"hide_msgbox();\" /></div>', 650, 50);
}

/************************************** 功能函数 *****************************************/

/**
 *	检测雇主注册	
 *	@para	phone,email,password
 *	return 	bool
 */
function _check_client_register(phone, email, password, tag) {
    if (typeof (tag) == "undefined") tag = 'msg';
    if (!is_mobile(phone)) { showmsg(tag, 'error', '请输入正确的手机号码'); return false; }
    if (!is_email(email)) { showmsg(tag, 'error', '请输入正确的Email地址'); return false; }
    //if(!is_numeric(password) || empty(password)){showmsg(tag,'error','请输入您的4位数字密码');return false;}
    if (empty(password)) { showmsg(tag, 'error', '请输入您密码'); return false; }
    return true;
}

/**
 *	首页弹窗展示完成项目的详情
 */
function project_box_show(id) {
    var _html = '<div class="project_box" id="project_box">';
    $j.ajax({
        type: "POST",
        dataType: "json",
        url: "majax.php",
        data: "id=" + id + "&action=project_box_show",
        success: function (html) {
            if (html) {
                _html += '<div class="img-container" style="background:url(' + html.logo + ') no-repeat center center;"><span class="winner-sash"></span></div>';
                _html += '<div class="pr"><h1><span  style="float:left;">' + html.cname + '标志设计</span>';
                switch (html.taocan) {
                    case '4': _html += '<span style="background:#4ac711;padding:3px;color:#fff;vertical-align:super;font-size:12px;font-weight:normal;float:left;">经济套餐</span>'; break;
                    case '6': _html += '<span style="background:#ff3300;padding:3px;color:#fff;vertical-align:super;font-size:12px;font-weight:normal;float:left;">豪华套餐</span>'; break;
                    default: _html += '<span style="background:#4198f2;padding:3px;color:#fff;vertical-align:super;font-size:12px;font-weight:normal;float:left;">标准套餐</span>'; break;
                }
                _html += '</h1><div class="clear"></div>';

                _html += '<div class="uc">';
                if (html.comment) {
                    _html += '客户评价：';
                    for (var i = 0 ; i < html.comment; i++) {
                        _html += '<img style="vertical-align:-3px;" src="../images/star-1.png">';
                    }
                    for (var i = 0 ; i < 5 - html.comment; i++) {
                        _html += '<img style="vertical-align:-3px;" src="../images/star-2.png">';
                    }
                    _html += ' (' + html.comment + '分)';
                }
                _html += '</div>';

                _html += '<div class="cd"><div>' + html.cintro + '</div><div>' + html.content + '</div></div>';

                _html += '<div style="hegiht:21px;text-align:center;margin-top:15px;"><a href="project.php?id=' + id + '" class="btn btn-info">项目详细信息&gt;&gt;</a>　　　<a href="post.php" class="btn btn-danger">开始我的设计&gt;&gt;</a></div></div><div class="clear"></div>';

                if (html.rel) {
                    _html += '<div class="rel"><div style="padding:15px 0 8px;background:url(../images/s_desc.gif) no-repeat 275px 18px;">每个项目我们的设计师都将<font color="red">提供多款方案供您选择！</font></div>';
                    for (i = 0; i < html.rel.length; i++) {
                        if (i % 5 == 4)
                            _html += '<img width="140" height="106" style="border:1px solid #ccc;margin-bottom:10px;" src="' + html.rel[i] + '" />';
                        else
                            _html += '<img width="140" height="106" style="border:1px solid #ccc;margin-right:5px;margin-bottom:10px;" src="' + html.rel[i] + '" />';
                    }
                    _html += '</div>';
                }

                html += '</div>';

                $j('#project_box_div').html(_html);

                $j.fn.colorbox({ inline: true, href: '#project_box', initialWidth: '730px' });
            }
        }
    });
}


function select_vote_works() {
    var _html = '';
    jQuery.ajax({
        type: "POST",
        dataType: "json",
        url: "../majax.php",
        data: "action=select_vote_works&type=" + jQuery('#type').val(),
        success: function (html) {
            if (html.code == '0') {	//非设计师
                _html = '<div class="init1"><span class="font50">设计师登录</span></div><table cellspacing="0" border="0" width="100%"><tr><td align="right" width="20%" height="35"><b>用户名:</b>&nbsp;&nbsp;</td><td colspan="2"><input type="text" class="textx" id="email"></td></tr><tr><td align="right" height="35"><b>密码:</b>&nbsp;&nbsp;</td><td colspan="2"><input type="password" class="textx" id="password"></td></tr><tr><td align="right" height="35"></td><td width="19%"><button onclick="vote_designer_login();" class="submit">登录</button><iframe id="interface" style="display:none;"></iframe></td><td><div class="msg" id="designer_msg"></div></td></tr><tr><td></td><td style="padding-top:7px;line-height:20px;" colspan="2"><b>你是设计师？</b>&nbsp;&nbsp;<a class="a10" href="../index.php">立即申请加入标志123...</a><br/>标志123的签约设计师能获得比在其他地方更加丰厚的收入。 只要上传你的作品，每月都能参加我们当月优秀作品的评选赢取高达1500元的奖金。<br/><a class="a10" href="../index.php">立即加入&gt;&gt;</a></td></tr></table>';
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "320px", html: _html });

            } else {
                if (html.all_works.length == 0 && html.selected.length == 0) {
                    jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="error2">您上个月未参加项目设计，没有作品能参加评选活动！</div>' });
                } else {
                    for (var i = 0 ; i < html.all_works.length; i++) {
                        _html += '<div class="vote_ui" style="margin-right:8px;" id="select_' + html.all_works[i].id + '"><div class="photo"><img width="210" lang="" onerror="if(application.isFF)this.src=\'/images/no_photo.gif\';" src="' + html.all_works[i].logo + '"></div><div class="actions"><a class="btn11 btnother" href="#" onclick="vote_work_start(\'' + html.all_works[i].id + '\',\'' + html.all_works[i].logo + '\',\'' + html.all_works[i].taocan + '\');return false;">添加</a></div></div>';
                    }
                    _html += '<div class="clear"></div>';

                    //已经选择的作品
                    var _selected = '';
                    var _selected_h1 = '你现在有 ' + html.selected.length + ' 个作品正参加评选';
                    if (html.selected.length == 0) {
                        _selected = '<p>您还没有选择作品参加评选活动！</p>';
                    } else {
                        for (var i = 0 ; i < html.selected.length; i++) {
                            _selected += '<div class="vote_ui" style="margin-right:8px;"><div class="photo"><img width="210" lang="" onerror="if(application.isFF)this.src=\'/images/no_photo.gif\';" src="' + html.selected[i].logo + '"></div><div class="actions"><a class="btn11 btnother" href="#" onclick="delete_vote_work(\'' + html.selected[i].vote_id + '\');return false;">删除</a></div></div>';
                        }
                        _selected += '<div class="clear"></div>';
                    }

                    var num = html.level - html.selected.length;
                    if (num > 0) {
                        _selected_h1 += '，你还可以选择 ' + num + ' 个作品参加评选。';
                    }

                    _html = '<div class="div92" style="width:720px;"><div style="border:1px solid #e6e6e6;background:#fff;padding:5px 10px;font-size:14px;line-height:24px;margin-right:8px;">你将可以从上月的作品中选择你喜欢的设计参与本月的优秀作品评选活动。  月冠军将完全由获得的票数决定。 除了赢取大奖， 雇主还能直接邀请你参与他的设计项目哦！ <a href="#" onclick="jQuery.fn.colorbox({html:jQuery(this).parent().find(\'div\').html()});return false;">了解更多</a><div style="display:none;"><div style="font-size:14px;line-height:24px;width:500px;"><b style="font-size:16px;">什么是“订金制“设计邀请？</b><br />标志123的【平面设计】和【网页设计】项目采取邀请制。 就是雇主直接选择一名或者多名设计师为其进行设计。 被邀请的设计师将首先获得设计订金， 如果作品中标再能获得中标奖金。 <br /><br /><i style="font-size:16px;">【设计订金标准】:</i><br />海报/画册设计 ： 50元/人<br />包装设计： 70元/人				<br />网页设计： 100元/人<br /><br /><i style="font-size:16px;">【中标奖金标准】：</i><br />中标奖金将根据雇主选择的具体套餐， 将显示在项目右侧信息栏。<br /><br /><i style="font-size:16px;">【如果获得邀请？】</i>	<br />你只要将你的成功作品添加到“我的设计秀” 吸引客户的眼球就有机会获得邀请哦！ 现在就去 <a href="../user/designer.php?id=' + jQuery('#user_id').val() + '" style="font-size:14px;">我的设计秀>></a></div></div></div><h2>' + _selected_h1 + '</h2><div id="vote_selected">' + _selected + '</div><h2>请从你下面的作品中选择</h2><div id="work_list">' + _html + '</div></div>';
                    jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", html: _html });
                    vote_bind()
                }
            }
        }
    });
}


//获取所有参评作品
function show_all_vote_works() {
    var _html = '';
    jQuery.ajax({
        type: "POST",
        dataType: "json",
        url: "../majax.php",
        data: "action=show_vote_works&type=" + jQuery('#type').val(),
        success: function (html) {
            if (html.all_works.length == 0) {
                _html = '<p>目前没有作品参加评选活动！</p>';
            } else {
                var _html1 = '<div class="vote-col">';
                var _html2 = '<div class="vote-col">';
                var _html3 = '<div class="vote-col">';
                for (var i = 0 ; i < html.all_works.length; i++) {
                    //留言
                    var message = '<div class="vote_message_head"><img width="30" onerror="if(application.isFF)this.src=\'/images/designer_48.gif\';" src="' + html.all_works[i].user.face + '" /></div><div class="vote_message_content">';
                    if (html.all_works[i].company_name == 'undefined' || html.all_works[i].company_name == false) {
                        message += '<a href="designer.php?id=' + html.all_works[i].user.id + '">' + html.all_works[i].user.user_name + '</a> 上传的作品</div><div class="clear"></div>';
                    } else {
                        message += '<a href="designer.php?id=' + html.all_works[i].user.id + '">' + html.all_works[i].user.user_name + '</a> 在 <a href="../' + html.all_works[i].pt + '/project.php?id=' + html.all_works[i].project_id + '">' + html.all_works[i].company_name + '</a> 项目中的作品</div><div class="clear"></div>';
                    }


                    for (var j = 0 ; j < html.all_works[i].message.length; j++) {
                        var _message = '<div class="vote_message_head"><img width="30" onerror="if(application.isFF)this.src=\'/images/designer_48.gif\';" src="' + html.all_works[i].message[j].face + '" /></div><div class="vote_message_content">' + html.all_works[i].message[j].user_name + '：' + html.all_works[i].message[j].content + '</div><div class="clear"></div>';
                        message += '<div class=" vote-border-top">' + _message + '</div>';
                    }

                    var content = '<div class="vote_ui"><div class="photo"><img width="210" onerror="if(application.isFF)this.src=\'/images/no_photo.gif\';" src="' + html.all_works[i].logo + '" onclick="vote_work_show(jQuery(this).attr(\'src\'),\'' + html.all_works[i].taocan + '\');" style="cursor:pointer;"/></div><div class="author"><div>' + html.all_works[i].remark + '</div>当前票数：<b class="red">' + html.all_works[i].vote_num + '</b> 票</div><div class="actions" lang="' + html.all_works[i].vote_id + '"><a class="btn11 btnvote" href="#"><span>投一票</span></a><a class="btn11 btnmsg" href="#"><span>评论</span></a></div><div id="vote_message_' + html.all_works[i].vote_id + '" class="vote_message">' + message + '</div></div>';
                    //content = content.replace(/\\/g,"\\\\").replace(/'/g,"\\\'");

                    eval('_html' + ((i) % 3 + 1) + "+='" + content.replace(/\\/g, "\\\\").replace(/'/g, "\\\'") + "'");

                }
                _html += _html1 + '</div>' + _html2 + '</div>' + _html3 + '</div>' + '<div class="clear"></div>';
            }
            jQuery('#vote_works').html(_html);
            vote_bind();
        }
    });
}

function vote_work_start(work_id, logo, taocan) {
    var _h = '';
    var _w = '';
    if (taocan == 'logo') {
        _h = 250; _w = 330;
    } else if (taocan == 'dm') {
        _h = 600; _w = 500;
    } else if (taocan == 'pkg') {
        _h = 450; _w = 800;
    } else if (taocan == 'web') {
        _h = 960; _w = 800;
    }
    var default_message = '说说这个作品的亮点来吸引大家都投票哦！(不能少于30个字)';
    var work_message = '<div class="div44"><div class="div5"><textarea lang="' + default_message + '" onblur="if(this.value==\'\')this.value=this.lang;" onfocus="if(this.value==this.lang)this.value=\'\';" class="text_area3" id="work_message">' + default_message + '</textarea></div><div class="div9"></div><div class="left5"><table><tbody><tr><td><input type="button" lang="' + work_id + '" onclick="add_vote_work();" value="确 定" class="btn" id="work_btn"></td><td><input type="button" onclick="jQuery.fn.colorbox.close();" value="关 闭" class="btn"></td></tr></tbody></table></div><div class="clear"></div></div>';
    var html = "<div style='width:" + _w + "px;'><img src='" + logo + "' width='" + _w + "' height='" + _h + "' onerror=\"if(application.isFF)this.src='/images/no_photo.gif';\" /><div class='div7'></div>" + work_message + "</div>";
    jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", html: html });
}

function vote_work_show(logo, taocan) {
    var _h = '';
    var _w = '';
    if (taocan == 'logo') {
        _h = 250; _w = 330;
    } else if (taocan == 'dm') {
        _h = 600; _w = 500;
    } else if (taocan == 'pkg') {
        _h = 450; _w = 800;
    } else if (taocan == 'web') {
        _h = 960; _w = 800;
    }

    var html = "<img src='" + logo + "' onerror=\"if(application.isFF)this.src='/images/no_photo.gif';\" />";
    jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", html: html });
}

//添加参评作品
function add_vote_work() {
    var id = jQuery('#work_btn').attr('lang');
    var message = (jQuery('#work_message').val() == jQuery('#work_message').attr('lang')) ? '' : jQuery('#work_message').val();
    if (message == '' || message.length < 30) { jQuery('#work_message').focus(); return; }
    jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="loading1">操作中，请稍后...</div>' });
    jQuery.ajax({
        type: "POST",
        dataType: "json",
        url: "../majax.php",
        data: "action=add_vote_work&id=" + id + "&message=" + encodeURIComponent(message) + "&type=" + encodeURIComponent(jQuery('#type').val()),
        success: function (html) {
            if (html.code == '0') {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="error1">请先以设计师的身份登录。</div>' });
                setTimeout("jQuery.fn.colorbox.close()", 2000);
            } else if (html.code == '1') {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="error1">您的参评作品数量达到上限。</div>' });
                setTimeout("jQuery.fn.colorbox.close()", 2000);
            } else if (html.code == '2') {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="succeed2">谢谢参与！ 你的作品将进入本月的评选活动。 你可以随意给自己或者别人的作品投票(一台电脑一天只能投3票哦！)。每月得票最多的作品将胜出成为我们的月冠军，赢取大奖。 参与评选活动将增加你设计秀的曝光率，赢取雇主设计订单哦！</div><p style="text-align:center;"><button onclick="jQuery.fn.colorbox.close();">知道了</button></p>' });
                show_all_vote_works();
                jQuery('#select_' + id).remove();
            }

        }
    });
}

//删除参评作品
function delete_vote_work(id) {
    jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="loading1">操作中，请稍后...</div>' });
    jQuery.ajax({
        type: "POST",
        dataType: "json",
        url: "../majax.php",
        data: "action=delete_vote_work&id=" + id,
        success: function (html) {
            if (html.code == '0') {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="error1">请先以设计师的身份登录。</div>' });
            } else if (html.code == '2') {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="succeed1">删除成功！</div>' });
                jQuery('#work_list').html('');
                show_all_vote_works();
            }
            setTimeout("jQuery.fn.colorbox.close()", 2000);
        }
    });
}

//投票功能
function add_vote_num(vote_id) {
    jQuery.ajax({
        type: "POST",
        dataType: "json",
        url: "../majax.php",
        data: "action=add_vote_num&id=" + vote_id + "&type=" + jQuery('#type').val(),
        success: function (html) {
            if (html.code == '1') {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="error1">您今天已经投过票了，请明天再来。</div>' });
            } else if (html.code == '2') {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="succeed1">+1 票， 谢谢你的支持！</div>' });
                show_all_vote_works();
            }
            setTimeout("jQuery.fn.colorbox.close()", 2000);
        }
    });
}

function add_vote_message(vote_id) {
    var message = jQuery('#vote_message_' + vote_id).find('textarea').val();
    if (message == jQuery('#vote_message_' + vote_id).find('textarea').attr('lang')) {
        jQuery('#vote_message_' + vote_id).find('textarea').focus()
    } else {
        jQuery.ajax({
            type: "POST",
            dataType: "json",
            url: "../majax.php",
            data: "action=add_vote_message&id=" + vote_id + "&message=" + encodeURIComponent(message),
            success: function (html) {
                if (html.code == '1') {
                    jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="error1">请先登录。</div>' });
                } else if (html.code == '2') {
                    var _html = '<div class="vote-border-top"><div class="vote_message_head"><img width="30" onerror="if(application.isFF)this.src=\'/images/designer_48.gif\';" src="' + jQuery('#user_face').val() + '" /></div><div class="vote_message_content">' + jQuery('#user_name').val() + '：' + jQuery('#vote_message_' + vote_id).find('textarea').val() + '</div><div class="clear"></div></div>';
                    jQuery('#vote_message_' + vote_id).find('.vote_message_box').remove();
                    jQuery('#vote_message_' + vote_id).html(jQuery('#vote_message_' + vote_id).html() + _html);
                }
            }
        });
    }
}

function vote_bind() {
    jQuery('.vote_ui').mouseover(function () {
        jQuery(this).find('.actions').show();
    });
    jQuery('.vote_ui').mouseleave(function () {
        jQuery(this).find('.actions').hide();
    });
    //绑定投一票、评论按钮事件
    jQuery(".btn11").click(function () {
        var vote_id = jQuery(this).parent().attr('lang');
        if (jQuery(this).find('span').html() == '评论') {
            if (jQuery('#user_id').val() < 1) {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="error1">请先登录。</div>' });
            } else {
                if (jQuery('#vote_message_' + vote_id).find('textarea').length > 0) {
                    jQuery('#vote_message_' + vote_id).find('.vote_message_box').remove();
                } else {
                    var message_box = '<div class="vote_message_box"><div class="vote_message_head"><img width="30" onerror="if(application.isFF)this.src=\'/images/designer_48.gif\';" src="' + jQuery('#user_face').val() + '" /></div><div class="vote_message_content"><textarea lang="添加评论..." onblur="if(this.value==\'\')this.value=this.lang;" onfocus="if(this.value==this.lang)this.value=\'\';">添加评论...</textarea><p class="vote_message_btn"><a href="#" onclick="add_vote_message(' + vote_id + ');return false;">添加</a></p></div><div class="clear"></div></div>';
                    jQuery('#vote_message_' + vote_id).html(jQuery('#vote_message_' + vote_id).html() + message_box);
                    jQuery('#vote_message_' + vote_id).find('textarea').focus();
                }
            }
            return false;
        } else if (jQuery(this).find('span').html() == '投一票') {
            add_vote_num(vote_id);
            return false;
        }
    });
}

function set_sjgw_status() {
    $j.colorbox.close();
    var url = '../ajax.php?action=sjgw_pop_status';
    ajax.response(xml, url, '');
}


//保存设计师选择的标签
function modify_label(user_id, closepanel) {
    var labels = jQuery('.dellabel');
    var str = "";
    var str2 = "";
    jQuery.each(labels, function () {
        str += "(" + user_id + "," + jQuery(this).attr("class_ref") + "),";
        str2 += jQuery(this).attr("class_ref") + ",";
    });
    str = str.substring(0, str.length - 1);
    str2 = str2.substring(0, str2.length - 1);//用来确定选择了哪些业务
    //alert(str2);
    jQuery.ajax({
        type: "POST",
        url: "../ajax_page.php",
        data: "str=" + str + "&str2=" + str2 + "&user_id=" + user_id + "&action=modify_label",
        success: function (re) {
            if (closepanel == 1) {
                showmsg('label_msg', 'succeed', '修改成功!');
                setTimeout(function () {
                    jQuery.colorbox.close();
                    window.location.reload();
                }, 2000);
            } else {
                //跳转到步骤三
                //jQuery.fn.colorbox({initialWidth:"0px",initialHeight:"0px",inline:true,href:"#wsstep3"});
                jQuery.fn.colorbox({ href: "../user/openbusiness.php" });
            }
        },
        failure: function () { }
    });
}

//网站投稿
function upload_site(price, time, intro, id) {
    var d_v = '请务必给出有价值的任务分析。 广告似的报价将被管理员删除并取消参与资格。';
    if (intro == '') intro = d_v;
    var html = '<div style="width:420px;"><input type="hidden" id="s_id" value="' + id + '"/><div class="div44" style="line-height:20px;font-size:14px;"><b class="red">非常重要：</b><br>　　标志123的每个招标任务都经我们的客服人工审核确保任务的真实性。 同时雇主也预付了项目的诚意金。 我们要求工作者首先认真分析雇主的任务后再进行报价。方案描述中请务必：<br><b>　　1. 谈及雇主的具体项目内容，证明你有认真看过项目需求<br>　　2. 说说你认为成功完成雇主任务的核心关键</b><br><span class="red">注： 广告类型的报价方案将被管理员删除并取消参与资格。</span></div><br/>';
    html += '<table width="100%" cellspacing="0" border="0"><tr><td width="80" height="30" align="right"><b>项目报价：</b></td><td colspan="2"><input type="text" class="textx" id="price" value="' + price + '"> 元</td></tr><tr><td height="30" align="right"><b>开发周期：</b></td><td colspan="2"><input type="text" class="textx" id="time" value="' + time + '"> 天</td></tr><tr><td height="30" align="right"><b>方案描述：</b></td><td colspan="2"><textarea class="text_area" id="intro" lang="' + d_v + '" onfocus="if(this.value==this.lang)this.value=\'\';" onblur="if(this.value==\'\')this.value=this.lang;" style="height:200px;">' + intro + '</textarea></td></tr><tr><td></td><td width="80"><button onclick="site();" class="submit btn btn-success" id="tax_btn">提 交</button></td><td><div class="msg" id="tax_msg">&nbsp;</div></td></tr></table></div>';
    //msgbox('提交方案',html,420,100);
    jQuery.fn.colorbox({ html: html });
}

function site() {
    var price = jQuery('#price').val();
    var time = jQuery('#time').val();
    var intro = jQuery('#intro').val();
    var id = jQuery('#s_id').val();
    var project_id = jQuery('#project_id').val();

    if (empty(price)) { showmsg('tax_msg', 'error', '请填写项目报价'); return; }
    if (empty(time)) { showmsg('tax_msg', 'error', '请填写项目开发周期'); return; }
    if (empty(intro)) { showmsg('tax_msg', 'error', '请填写项目方案描述'); return; }
    showmsg('tax_msg', 'loading', '提交中，请稍后...');

    jQuery.ajax({
        type: "POST",
        dataType: "json",
        url: "../ajax.php",
        data: "action=site_work_add&id=" + id + "&project_id=" + encodeURIComponent(project_id) + "&price=" + encodeURIComponent(price) + "&time=" + encodeURIComponent(time) + "&intro=" + encodeURIComponent(intro),
        success: function (html) {
            if (html.code == '0') {
                showmsg('tax_msg', 'succeed', '提交成功');
                setTimeout('winreload()', 1000);
            } else {
                showmsg('tax_msg', 'error', html.value);
            }
        }
    });
}

//显示支付余款信息
function site_pay_more(id) {
    jQuery.ajax({
        type: "POST",
        url: "../ajax.php",
        data: "action=site_pay_more&id=" + id,
        success: function (html) {
            jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", height: "520px", html: html });
        }
    });
}

//选标
function set_site_work_win_start(id, user_name, price, time, intro) {
    var html = '<div style="width:400px;line-height:20px;"><b class="font3x">确定选择“' + user_name + '“来完成您的项目吗？</b>';
    html += '<p><b class="font3">周期/报价：</b>' + price + '元在' + time + '天内完成</p><p><b class="font3"> 项目方案：</b><br/>' + intro + '</p><br/><p style="text-align:center;"><button onclick="set_site_work_win(' + id + ')" style="font-size:16px;">下一步，托管赏金</button> 　　<button onclick="jQuery.fn.colorbox.close();" style="font-size:16px;">取消</button></p></div>';
    jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", html: html });
}
function set_site_work_win(id) {
    jQuery.ajax({
        type: "POST",
        dataType: "json",
        url: "../ajax.php",
        data: "action=set_site_work_win&id=" + id,
        success: function (html) {
            winreload();
        }
    });
}

//取消选标
function cancel_site_work(id) {
    jQuery.ajax({
        type: "POST",
        dataType: "json",
        url: "../ajax.php",
        data: "action=cancel_site_work&id=" + id,
        success: function (html) {
            if (html.code == '0') {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="error1">' + html.val + '</div>' });
            } else if (html.code == '1') {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="succeed1">取消方案成功！</div>' });
                setTimeout('winreload()', 1000);
            }
        }
    });
}

//网站项目确认
function site_confirm() {
    if (!confirm('当您确认后, 该项目将正式结束.\n\n我们将会给中标的团队发放相应的设计奖金. 确认项目要结束了吗?')) return;
    msgbox('确认项目结束..', '<div class="loading1">请稍候...</div>', 340, 200);
    var project_id = $('project_id').value;
    var url = '../ajax.php?project_id=' + project_id + '&action=site_confirm';
    ajax.response(xml, url, comfirm_package_ed);
}

//时薪项目托管资金弹窗
function hourly_money_confirm_start(id) {
    var html = '<div id="new2012"><div class="colorbox"><h2 class="title">托管资金</h2><div class="c"><p>托管项目资金后才能进入下一步沟通。</p><a href="#" class="btn btn-danger pull-right" onclick="hourly_money_confirm(' + id + ');return false;">托管资金</a><a class="btn pull-right btn-default" href="#" onclick="jQuery.colorbox.close();return false;">取消</a></div></div></div>';
    jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: html });
}

//时薪项目托管资金
function hourly_money_confirm(id) {
    jQuery.ajax({
        type: "POST",
        dataType: "json",
        url: "../majax.php",
        data: "action=hourly_money_confirm&id=" + id,
        success: function (html) {
            if (html.code == '0') {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="error1">' + html.val + '</div>' });
            } else if (html.code == '1') {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="succeed1">托管资金成功！</div>' });
                setTimeout(go_url("../hourly/project.php?id=" + id), 1000);
            }
        }
    });
}

function hourly_invite_start(id, type) {
    jQuery.ajax({
        type: "POST",
        dataType: "json",
        url: "../majax.php",
        data: { "action": "hourly_invite_start", "id": id },
        success: function (html) {
            if (html.code == '0') {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="error1">' + html.val + '</div>' });
            } else if (html.code == '1') {
                if (html.val.length > 0) {

                    var _html = '<input type="hidden" id="pid_invite" value="' + html.pid + '" />';
                    if (type == '1') {
                        _html += '<div class="clearfix" id="new2012"><div class="colorbox"><div class="c_con text-center"><p style="font-size:22px;">估计他们也能完成您的任务， 同时将雇佣邀请发送给他们？</p></div></div></div><br/>';
                    } else {
                        _html += '<div class="clearfix" id="new2012"><div class="colorbox"><div class="c_con text-center"><p style="font-size:22px;">估计他们也能完成您的任务， 同时将雇佣邀请发送给他们？</p></div></div></div><br/>';
                    }
                    for (var i = 0; i < html.val.length; i++) {
                        _html += '<div class="designer-card clearfix"><div class="pull-left"><img src="../' + html.val[i].face + '" style="width:210px; height:210px;" /></div><div class="user-info pull-left"><h1 class="user-name">' + html.val[i].user_name + '</h1>' + html.val[i].level_image + ' ' + html.val[i].level_txt + '&nbsp;&nbsp;' + html.val[i].online + '<div class="level">' + html.val[i].degree + '<span class="ml1">总收入：</span><span class="red">￥' + html.val[i].income + '</span></div><p class="light mt1">' + html.val[i].intro + '</p><div class="skill mt1"><span class="title">技能：</span>';
                        for (var s = 0; s < html.val[i].skill.length; s++) {
                            if (html.val[i].skill[s].label_type == '2')
                                _html += '<span>' + html.val[i].skill[s].label_name + '</span>';
                        }
                        _html += '</div></div><div class="cando pull-left"><div class="offer"><h2 class="title">我能为企业提供：</h2>';

                        for (var f = 0; f < html.val[i].skill.length; f++) {
                            if (html.val[i].skill[f].label_type == '1')
                                _html += '<span>' + html.val[i].skill[f].label_name + '</span>';
                        }
                        //_html += '</div><div class="hire mt1"><div class="money">雇佣时薪：￥'+html.val[i].hourlywage+'</div><a href="#" class="btn btn-warning mt1 pull-right" lang="'+html.val[i].id+'" onclick="jQuery(this).addClass(\'disabled\');jQuery(this).removeClass(\'btn-warning\');return false;">任务费用：￥'+html.val[i].wage+'</br>点击雇佣我</a></div></div></div><br/>';
                        _html += '</div><div class="hire mt1 clearfix"><div class="money text-center">雇佣时薪：￥' + html.val[i].hourlywage + '/<span class="font12">小时</span></br>任务费用：￥' + html.val[i].wage + '<label class="checkbox"><input type="checkbox" class="employCheckbox" value="' + html.val[i].id + '">雇佣TA</label></div></div></div></div><div style="width:828px; height:12px; background:url(../images/bg_topfoot.png); margin:0 auto;"></div><br/>';

                    }
                    _html += '<div class="clearfix"></div><a class="btn btn-success pull-right" href="#" onclick="hourly_invite();return false;">确定</a><a class="btn pull-right btn-default mr1" href="#" onclick="jQuery.colorbox.close();return false;">取消</a>';
                }
                //alert(_html);
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "840px", html: _html });
            }
        }
    });
}

function hourly_invite() {
    if (jQuery('.employCheckbox:checked').length == 0) {
        jQuery.colorbox.close();
        return;
    }
    // if(jQuery("a.disabled").length == 0){
    // 	jQuery.colorbox.close();
    // 	return;
    // }
    var user = new Array();
    // jQuery("a.disabled").each(function(i){
    // 	user[i] = jQuery(this).attr('lang');		
    // });
    jQuery('.employCheckbox:checked').each(function (i) {
        user[i] = jQuery(this).val();
    })
    jQuery.ajax({
        type: "POST",
        dataType: "json",
        url: "../majax.php",
        data: { "user[]": user, "action": "hourly_invite", "id": jQuery("#pid_invite").val() },
        success: function (result) {
            if (result.code == '0') {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="error1">' + result.val + '</div>' });
            } else if (result.code == '1') {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="succeed1">邀请成功！</div>' });
                setTimeout(go_url("hourly.php"), 1000);
            }
        }
    });
}
function complete_confirm(pid, designer_id) {
    if (confirm("点击确定后项目奖金将直接发放给设计师，您确定项目已经完成了吗？")) {
        jQuery.ajax({
            type: "POST",
            url: "../ajax.php",
            data: "project_id=" + pid + "&designer_id=" + designer_id + "&action=ajax_complete_employ",
            success: function () {
                window.location.reload();
            }
        });
    }
}
//确认报名/取消报名
function execute_sign_up(type, list) {
    var pid;
    if (type == 'add') {
        pid = jQuery('#confirm_signup_pid').val();
        jQuery.ajax({
            type: "POST",
            url: "../ajax.php",
            data: "pid=" + pid + "&type=" + type + "&action=confirm_sign_up",
            success: function (html) {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="succeed1">' + html + '</div>' });
                if (list == '') {
                    window.location.reload();
                } else {
                    window.location.href = "project.php?id=" + pid;
                }

            },
            failure: function () { }
        });
    } else {
        pid = jQuery('#cancel_signup_pid').val();
        jQuery.ajax({
            type: "POST",
            url: "../ajax.php",
            data: "pid=" + pid + "&type=" + type + "&action=confirm_sign_up",
            success: function (html) {
                jQuery.fn.colorbox({ initialWidth: "0px", initialHeight: "0px", innerWidth: "300px", html: '<div class="succeed1">' + html + '</div>' });
                window.location.reload();
            },
            failure: function () { }
        });
    }

}

function ajax_delete_work(workid, imgpath, obj) {
    var jQobj = jQuery(obj).parent().parent();
    jQuery.ajax({
        type: "POST",
        url: "../ajax_page.php",
        data: "work_id=" + workid + "&logo=" + imgpath + "&action=ajax_delete_work",
        success: function (msg) {
            jQobj.remove();
        },
        failure: function () { alert("AJAX Error!"); }
    })
}